Makefile (2250B)
1 include ../etc/Makefile.def 2 3 all: 4 ../tools/gettools e-ver e-txt2c c-conf 5 ../tools/e-ver ../ChangeLog $(VER) 6 $(MAKE) textconv 7 $(MAKE) grammar 8 $(MAKE) objects 9 $(MAKE) crossroads 10 11 install: all $(BINDIR)/crossroads 12 13 $(BINDIR)/crossroads: crossroads 14 cp crossroads $(BINDIR)/ 15 strip $(BINDIR)/crossroads 16 17 samplerun: all 18 -./crossroads -c sample.conf stop 19 ./crossroads -c sample.conf start 20 21 textconv: usage.h proxyerror.h 22 usage.h: usage.txt 23 ../tools/untab usage.txt 24 ../tools/e-txt2c USAGETEXT <usage.txt >usage.h 25 proxyerror.h: proxyerror.txt 26 ../tools/untab proxyerror.txt 27 ../tools/e-txt2c ERRORTEXT <proxyerror.txt >proxyerror.h 28 29 grammar: parser.c lexer.c 30 lexer.c: lexer.l 31 flex -o$@ $< 32 parser.c: parser.y 33 bison -d -o $@ $< 34 35 SRC = $(wildcard *.c) 36 OBJ = $(patsubst %.c, %.o, $(SRC)) 37 objects: $(OBJ) 38 39 CC = $(shell ../tools/c-conf c-compiler) 40 41 DEFS = -DDEFAULT_CONF=\"$(DEFAULT_CONF)\" -DMAX_BACKEND=$(MAX_BACKEND) \ 42 -DSHM_MASK=$(SHM_MASK) -DSLEEP_TIME=$(SLEEP_TIME) \ 43 -DCONNECT_TIMEOUT=$(CONNECT_TIMEOUT) -DVER=\"$(VER)\" \ 44 -DSET_PROC_TITLE_BY_ARGV=$(SET_PROC_TITLE_BY_ARGV) \ 45 -DTCP_BUFSZ=$(TCP_BUFSZ) \ 46 $(shell ../tools/c-conf ifheader malloc.h HAVE_MALLOC_H) \ 47 $(shell ../tools/c-conf ifheader stdint.h HAVE_STDINT_H) \ 48 $(shell ../tools/c-conf libfunction flock HAVE_FLOCK) \ 49 $(shell ../tools/c-conf libfunction lockf HAVE_LOCKF) \ 50 $(shell ../tools/c-conf libfunction strlcat HAVE_STRLCAT) \ 51 $(shell ../tools/c-conf libfunction sranddev HAVE_SRANDDEV) \ 52 $(shell ../tools/c-conf libfunction vsyslog HAVE_VSYSLOG) \ 53 $(shell ../tools/c-conf libfunction strcasestr HAVE_STRCASESTR) 54 55 LIBS = $(shell ../tools/c-conf lib ucb nsl pthread socket 2>/dev/null) 56 57 parser.o: parser.c 58 $(CC) $(DEFS) -c -g $< 59 60 lexer.o: lexer.c 61 $(CC) $(DEFS) -c -g $< 62 63 %.o: %.c 64 $(CC) $(DEFS) -c -g -Wall $< 65 66 crossroads: libcrossroads.a 67 $(CC) $(EXTRALIBS) -g -L. -lcrossroads $(LIBS) -o $@ -lm 68 69 libcrossroads.a: $(OBJ) 70 ar rs libcrossroads.a $(OBJ) 71 72 distclean: clean 73 clean: 74 rm -f $(OBJ) libcrossroads.a crossroads \ 75 usage.h proxyerror.h 76 77 # Extra deps: 78 usage.o: usage.c usage.h ../etc/Makefile.def 79 main.o: main.c crossroads.h ../etc/Makefile.def 80 sampleconf.o: sampleconf.c sampleconf.h