Makefile (2247B)
1 2 # Configuration 3 DIRS = $(shell find . -type d | grep -v '.svn') 4 BUILDDIR = build 5 BIN = $(BUILDDIR)/xr 6 LIB = $(BUILDDIR)/libxr.a 7 TMPXR = /tmp/xr-$(shell whoami) 8 CONF_CC = $(shell etc/c-conf -c $(BUILDDIR)/config.cache c++-compiler) 9 CONF_OPTFLAGS = $(shell etc/c-conf -c $(BUILDDIR)/config.cache optflags) 10 CONF_LIB = $(shell etc/c-conf -c $(BUILDDIR)/config.cache \ 11 lib ucb nsl pthread socket m alf) 12 CONF_GETOPT = $(shell etc/c-conf -c $(BUILDDIR)/config.cache \ 13 ifheader getopt.h HAVE_GETOPT_H) 14 CONF_GETOPT_LONG = $(shell etc/c-conf -c $(BUILDDIR)/config.cache \ 15 libfunction getopt_long HAVE_GETOPT_LONG) 16 CONF_INET_ATON = $(shell etc/c-conf -c $(BUILDDIR)/config.cache \ 17 libfunction inet_aton HAVE_INET_ATON) 18 CONF_STRNSTR = $(shell etc/c-conf -c $(BUILDDIR)/config.cache \ 19 libfunction strnstr HAVE_STRNSTR) 20 21 foo: 22 $(MAKE) subdirs 23 $(MAKE) $(BIN) 24 25 install: $(BINDIR)/xr 26 $(BINDIR)/xr: $(BIN) 27 cp $(BIN) $(TMPXR) 28 strip $(TMPXR) 29 install $(TMPXR) $(BINDIR)/xr 30 rm -f $(TMPXR) 31 32 subdirs: $(BUILDDIR)/usage.h $(BUILDDIR)/status.xslt.h 33 @echo 'About to build in class dirs: $(DIRS)' 34 @for f in $(DIRS) ; do \ 35 echo "Making: $$f"; \ 36 BASE=$(BASE) CC=$(CONF_CC) BUILDDIR=$(BUILDDIR) VER='$(VER)' \ 37 AUTHOR='$(AUTHOR)' MAINTAINER='$(MAINTAINER)' \ 38 DISTSITE='$(DISTSITE)' MEMDEBUG=$(MEMDEBUG) BINDIR='$(BINDIR)' \ 39 CONF_CC='$(CONF_CC)' CONF_LIB='$(CONF_LIB)' \ 40 CONF_GETOPT=$(CONF_GETOPT) CONF_GETOPT_LONG=$(CONF_GETOPT_LONG) \ 41 CONF_INET_ATON=$(CONF_INET_ATON) \ 42 CONF_OPTFLAGS='$(CONF_OPTFLAGS)' \ 43 CONF_STRNSTR=$(CONF_STRNSTR) \ 44 $(MAKE) -C $$f -f $(BASE)/xr/etc/Makefile.class \ 45 || exit 1; \ 46 done 47 ar rs $(LIB) */*.o 48 ranlib $(LIB) 49 $(BUILDDIR)/usage.h: etc/usage.txt 50 etc/e-txt2c USAGE <etc/usage.txt >$(BUILDDIR)/usage.h 51 touch config/parsecmdline.cc 52 $(BUILDDIR)/status.xslt.h: etc/status.xslt 53 etc/e-txt2c XSLT <etc/status.xslt >$(BUILDDIR)/status.xslt.h 54 touch webinterface/answerxslt.cc 55 56 $(BIN): $(LIB) 57 $(CONF_CC) $(PROF) $(CONF_OPTFLAGS) -g -o $(BIN) \ 58 -L$(BUILDDIR) -lxr $(CONF_LIB) 59 60 clean: 61 rm -f $(BIN) $(LIB) core obj/*.o etc/usage.h $(BUILDDIR)/config.cache 62 find . -name \*.bak -exec rm {} \; 63