| 1 | # Makefile for agedu. |
| 2 | |
| 3 | prefix = /usr/local |
| 4 | bindir = $(prefix)/bin |
| 5 | mandir = $(prefix)/man |
| 6 | man1dir = $(mandir)/man1 |
| 7 | |
| 8 | INSTALL = install |
| 9 | |
| 10 | CFLAGS = -Wall --std=c99 -pedantic $(XFLAGS) |
| 11 | |
| 12 | -include Makefile.local |
| 13 | |
| 14 | AGEDU_MODULES := agedu du alloc trie index html httpd fgetline licence |
| 15 | AGEDU_OBJS := $(patsubst %,%.o,$(AGEDU_MODULES)) |
| 16 | |
| 17 | ALLMODULES := $(sort $(AGEDU_MODULES)) |
| 18 | ALLOBJS := $(patsubst %,%.o,$(ALLMODULES)) |
| 19 | ALLDEPS := $(patsubst %,%.d,$(ALLMODULES)) |
| 20 | |
| 21 | BINARIES = agedu |
| 22 | |
| 23 | binaries: $(BINARIES) |
| 24 | |
| 25 | agedu: config.h $(AGEDU_OBJS) |
| 26 | gcc $(LFLAGS) -o agedu $(AGEDU_OBJS) |
| 27 | |
| 28 | config.h: configure |
| 29 | ./configure -q |
| 30 | rm -f Makefile # we keep using _this_ Makefile |
| 31 | |
| 32 | configure: configure.ac |
| 33 | aclocal |
| 34 | autoconf |
| 35 | autoheader |
| 36 | automake -a --foreign |
| 37 | |
| 38 | INTERNALFLAGS=# |
| 39 | |
| 40 | $(ALLOBJS): %.o: %.c |
| 41 | gcc $(CFLAGS) -MM $*.c > $*.d |
| 42 | gcc $(CFLAGS) $(INTERNALFLAGS) -c $*.c |
| 43 | |
| 44 | MANPAGES = agedu.1 |
| 45 | |
| 46 | doc: $(MANPAGES) |
| 47 | $(MANPAGES): %.1: %.but |
| 48 | halibut --man=$*.1 $*.but |
| 49 | |
| 50 | clean: |
| 51 | rm -f $(ALLOBJS) $(ALLDEPS) $(MANPAGES) $(BINARIES) |
| 52 | |
| 53 | spotless: clean |
| 54 | rm -f config.h config.h.in config.log config.status configure |
| 55 | rm -f depcomp install-sh missing stamp-h1 |
| 56 | rm -f Makefile.in aclocal.m4 |
| 57 | rm -rf autom4te.cache .deps |
| 58 | |
| 59 | -include $(ALLDEPS) |