1219820Sjeffinclude ../config.mk
2219820Sjeffinclude ../config.in
3219820Sjeff
4219820SjeffSHELL=/bin/sh
5219820Sjeff
6219820SjeffBINDIR=$(TARGETDIR)/usr/sbin
7219820SjeffETCDIR=$(TARGETDIR)/etc
8219820Sjeff
9219820Sjeff##
10219820Sjeff## Variables
11219820Sjeff##
12219820Sjeff
13219820Sjeff# Final executable
14219820SjeffEXEC=gproxy
15219820Sjeff
16219820Sjeff# Directories
17219820SjeffTOP_DIR=.
18219820SjeffSRCDIR:=$(TOP_DIR)/src
19219820Sjeff
20219820Sjeff# Compiler flags
21219820Sjeff#CFLAGS+=-D@OS@ 
22219820SjeffCFLAGS+=-O2 -Wall 
23219820SjeffCFLAGS+= -I$(SRCDIR)/include -I../../acos/include -I../../acos/shared
24219820Sjeff
25219820Sjeffifeq ($(CONFIG_STATIC_PPPOE),y)
26219820SjeffCFLAGS  += -DSTATIC_PPPOE
27219820Sjeffelse
28219820SjeffCFLAGS  += -USTATIC_PPPOE
29219820Sjeffendif
30219820Sjeff
31219820Sjeff#-I/usr/include
32219820Sjeff#CC=@CC@
33219820Sjeff
34219820SjeffTHREAD_LIBS= -lpthread
35219820Sjeff
36219820Sjeff# Linker flags
37219820SjeffLDFLAGS += $(THREAD_LIBS)
38219820SjeffLDFLAGS	+= -L$(ROUTERDIR)/nvram -L$(INSTALLDIR)/nvram/usr/lib -lnvram
39219820SjeffLDFLAGS += -L../../acos/shared -L$(TARGETDIR)/shared/usr/lib -lacos_shared
40219820Sjeff
41219820Sjeff# Object files
42219820SjeffOBJ_ALL=*.o
43219820SjeffSRC=$(wildcard $(SRCDIR)/*.c)
44219820Sjeff# The following will expand to the full path of every .o file:
45219820SjeffOBJS=$(SRC:.c=.o)
46219820Sjeff
47219820Sjeff
48219820Sjeff##
49219820Sjeff## Targets
50219820Sjeff##
51219820Sjeff
52219820Sjeff# We're only interested in .o and .c prefixes (the following two lines make this
53219820Sjeff# Makefile more portable)
54219820Sjeff.SUFFIXES:
55219820Sjeff.SUFFIXES:.o .c
56219820Sjeff
57219820Sjeff# .PHONY targets : will be executed even if up to date. See GNU 
58219820Sjeff# Make Manual section 4.6 for further details
59219820Sjeff.PHONY: clean all mrproper generate $(DIRS) rec_exec install help
60219820Sjeff# Of course $(EXEC) isn't phony ! ("and I know phony, I'm a clown-fish" - Marlin :-))
61219820Sjeff
62219820Sjeff# Default target :
63219820Sjeffall: $(EXEC)
64219820Sjeff
65219820Sjeff$(EXEC): $(OBJS)
66219820Sjeff	$(CC) $(LDFLAGS) -o $(EXEC) $(OBJS)
67219820Sjeff
68219820Sjeff
69219820Sjeff%.o: %.c
70219820Sjeff	$(CC) -c $(CFLAGS) -o $@ $<
71219820Sjeff
72219820Sjeff
73219820Sjeffhelp:
74219820Sjeff	@ echo "Available targets :" 
75219820Sjeff	@ echo "  help : this message."
76219820Sjeff	@ echo "  all : build everything and produce $(EXEC) executable."
77219820Sjeff	@ echo "  clean : remove all objects file."
78219820Sjeff	@ echo "  mrproper : same as clean + remove $(EXEC) + remove files generated by ./configure + remove doc.\
79219820SjeffYou'll need to run ./configure again after that."
80219820Sjeff	@ echo "  generate : (UNIX )re-create Makefile's in subdirectories. Execute this after deep \
81219820Sjeffmodificaton of the code when dependencies have changed. This will recreate them."
82219820Sjeff	@ echo "  install : does nothing."
83219820Sjeff	@ echo "  doc : run doxygen to generate HTML n TeX doc of the code."
84219820Sjeff	@ echo "  <DIR> : where <DIR> is one of the sub-dir, to recompile only this very subdir."
85219820Sjeff
86219820Sjeffdoc:
87219820Sjeff	@ doxygen $(TOP_DIR)/Doxyfile
88219820Sjeff
89219820Sjeffinstall:
90219820Sjeff	@ echo "This target does currently nothing. The executable remain in"
91219820Sjeff	@ echo "this directory for greater convinience when used in conjunction"
92219820Sjeff	$(STRIP) $(EXEC)
93219820Sjeff	cp $(EXEC) ${BINDIR}
94219820Sjeff	cp ./etc/igmprt.conf ${ETCDIR}
95219820Sjeff
96219820Sjeffclean:
97219820Sjeff	-rm -rf $(TOP_DIR)/src/*.o $(TOP_DIR)/$(EXEC)
98219820Sjeff# Make ignore return status of commands begining with '-'
99219820Sjeffmrproper: clean
100219820Sjeff	-rm $(TOP_DIR)/$(EXEC) 
101219820Sjeff	-rm $(TOP_DIR)/*~ 
102219820Sjeff	-rm $(TOP_DIR)/src/*~ 
103219820Sjeff	-rm $(SRCDIR)/include/conf.h 
104219820Sjeff	-rm $(TOP_DIR)/Makefile 
105219820Sjeff	-rm $(TOP_DIR)/config.cache
106219820Sjeff	-rm -rf $(TOP_DIR)/doc
107219820Sjeff