#
# Get values from configure script.
#
VERSION=@VERSION@
LIBVERSION=@LIBVERSION@

#
# Enable really all warnings. This, though, gives
# a warning due to pthread.h and unistd.h.
#
# -Wredundant-decls
#
CXX      = @CXX@
CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
           -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
           -Wmissing-declarations -Wnested-externs

CXXINCLUDES = -I. -I../nxcomp

CC         = @CC@
CCFLAGS    = $(CXXFLAGS)
CCINCLUDES = -I. -I../nxcomp
CCDEFINES  =

LDFLAGS = @LDFLAGS@
LIBS    = @LIBS@

#
# Only if THREADS is defined.
#
# LIBS = $(LIBS) -lpthread
#

srcdir      = @srcdir@
prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@
man1dir     = @mandir@/man1
VPATH       = @srcdir@

INSTALL         = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA    = @INSTALL_DATA@
DESTDIR         =
RM_FILE         = rm -f

#
# This should be autodetected.
#

MAKEDEPEND     = @MAKEDEPEND@
DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3 

.SUFFIXES: .cpp.c

.cpp.o:
	$(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $<
.c.o:
	$(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $<

PROGRAM = nxproxy

all: depend $(PROGRAM)

MSRC   = Main.c

CSRC   =

CXXSRC =

MOBJ   = $(MSRC:.c=.o)
COBJ   = $(CSRC:.c=.o)
CXXOBJ = $(CXXSRC:.cpp=.o)

$(PROGRAM):	$(MOBJ) $(COBJ) $(CXXOBJ)
		$(CXX) $(CXXFLAGS) -o $@ $(MOBJ) $(LDFLAGS) $(LIBS)

depends:	depend.status

depend:		depend.status

depend.status:	
		if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \
			$(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \
			$(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) $(CXXSRC) 2>/dev/null; \
		fi
		touch depend.status

install:	install.bin install.man

install.bin:	$(PROGRAM)
		$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
		$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)

install.man:
		$(srcdir)/mkinstalldirs $(DESTDIR)$(man1dir)
		$(INSTALL_DATA) man/$(PROGRAM).1 $(DESTDIR)$(man1dir)/$(PROGRAM).1

uninstall:      uninstall.bin uninstall.man

uninstall.bin:
		$(RM_FILE) $(DESTDIR)$(bindir)/$(PROGRAM)

uninstall.man:
		$(RM_FILE) $(DESTDIR)$(man1dir)/nxproxy.1

clean:
		-rm -f *~ *.o *.bak st?????? core core.* *.out.* \
		$(PROGRAM) $(PROGRAM).exe $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE)

distclean:	clean
		-rm -rf autom4te.cache config.status config.log config.cache depend.status Makefile tags configure