| 1 |
michael |
3389 |
# Master makefile for modules. |
| 2 |
|
|
# |
| 3 |
|
|
# IRC Services is copyright (c) 1996-2009 Andrew Church. |
| 4 |
|
|
# E-mail: <achurch@achurch.org> |
| 5 |
|
|
# Parts written by Andrew Kempe and others. |
| 6 |
|
|
# This program is free but copyrighted software; see the file GPL.txt for |
| 7 |
|
|
# details. |
| 8 |
|
|
|
| 9 |
|
|
TOPDIR=../ |
| 10 |
|
|
include $(TOPDIR)/Makefile.inc |
| 11 |
|
|
|
| 12 |
|
|
########################################################################### |
| 13 |
|
|
|
| 14 |
|
|
SUBDIRS = $(shell for i in *; do test -f "$$i/Makefile" && echo "$$i"; done) |
| 15 |
|
|
.PHONY: all-dynamic all-static install clean spotless |
| 16 |
|
|
|
| 17 |
|
|
########################################################################### |
| 18 |
|
|
|
| 19 |
|
|
all-dynamic: |
| 20 |
|
|
@set -e ; for i in $(SUBDIRS) ; do \ |
| 21 |
|
|
$(MAKE) -C $$i $@ DIRNAME="$$i" CFLAGS="$(CFLAGS)" ; \ |
| 22 |
|
|
if $(TEST_NT) ! -f .stamp -o "$$i/.stamp" -nt .stamp ; then \ |
| 23 |
|
|
echo "touch .stamp" ; \ |
| 24 |
|
|
touch .stamp ; \ |
| 25 |
|
|
fi ; \ |
| 26 |
|
|
done |
| 27 |
|
|
|
| 28 |
|
|
all-static: |
| 29 |
|
|
@rm -f modext.h modsyms.c modlist.c |
| 30 |
|
|
@echo '#include "../config.h"' >>modlist.c |
| 31 |
|
|
@echo '#include "../defs.h"' >>modlist.c |
| 32 |
|
|
@echo '#include "modext.h"' >>modlist.c |
| 33 |
|
|
@echo '#include "modsyms.c"' >>modlist.c |
| 34 |
|
|
@echo 'struct {const char *name; void *symlist;} modlist[] = {' >>modlist.c |
| 35 |
|
|
@set -e ; for i in $(SUBDIRS) ; do \ |
| 36 |
|
|
$(MAKE) -C $$i $@ DIRNAME="$$i" CFLAGS="$(CFLAGS)" ; \ |
| 37 |
|
|
cat $$i/.modext-*.h >>modext.h ; \ |
| 38 |
|
|
cat $$i/.modsyms-*.c >>modsyms.c ; \ |
| 39 |
|
|
cat $$i/.modlist-*.c >>modlist.c ; \ |
| 40 |
|
|
if $(TEST_NT) "$$i/.stamp" -nt .stamp ; then \ |
| 41 |
|
|
echo "touch .stamp" ; \ |
| 42 |
|
|
touch .stamp ; \ |
| 43 |
|
|
fi ; \ |
| 44 |
|
|
done |
| 45 |
|
|
@echo '{0}};' >>modlist.c |
| 46 |
|
|
$(CC) -c modlist.c -o modlist.o |
| 47 |
|
|
ar -r modules.a modlist.o |
| 48 |
|
|
$(RANLIB) modules.a |
| 49 |
|
|
|
| 50 |
|
|
install: |
| 51 |
|
|
@set -e ; for i in $(SUBDIRS) ; do \ |
| 52 |
|
|
$(MAKE) -C $$i $@ DIRNAME="$$i" ; \ |
| 53 |
|
|
done |
| 54 |
|
|
|
| 55 |
|
|
clean spotless: |
| 56 |
|
|
@set -e ; for i in $(SUBDIRS) ; do \ |
| 57 |
|
|
$(MAKE) -C $$i $@ DIRNAME="$$i" ; \ |
| 58 |
|
|
done |
| 59 |
|
|
rm -f modext.h modsyms.c modlist.c *.[oa] .stamp */.stamp |
| 60 |
|
|
|
| 61 |
|
|
# Remove modules.a (for recompilation) if the top-level Makefile changed |
| 62 |
|
|
modules.a: ../Makefile ../Makefile.inc |
| 63 |
|
|
rm -f $@ |
| 64 |
|
|
|
| 65 |
|
|
$(DATDEST)/modules: |
| 66 |
|
|
$(MKDIR) $@ |