blob: 17ea017225df2c409256c36563c0278e0893fd0e [file] [log] [blame]
Marc Bouchere6869a82000-03-20 06:03:29 +00001#! /usr/bin/make
2
James Morrisc81a3f32006-05-24 16:11:58 +00003all: $(SHARED_LIBS) $(SHARED_SE_LIBS) $(EXTRAS)
Marc Bouchere6869a82000-03-20 06:03:29 +00004
Rusty Russell01c45202001-01-07 06:50:31 +00005experimental: $(EXTRAS_EXP)
6
Rusty Russell52451822000-08-27 07:47:46 +00007# Have to handle extensions which no longer exist.
Marc Bouchere6869a82000-03-20 06:03:29 +00008clean: $(EXTRA_CLEANS)
James Morrisc81a3f32006-05-24 16:11:58 +00009 rm -f $(SHARED_LIBS) $(SHARED_SE_LIBS) $(EXTRAS) $(EXTRAS_EXP) $(SHARED_LIBS:%.so=%_sh.o) $(SHARED_SE_LIBS:%.so=%_sh.o)
Harald Welte3efb6ea2001-08-06 18:50:21 +000010 rm -f extensions/initext.c extensions/initext6.c
Harald Weltedb16ed12001-07-31 20:51:31 +000011 @find . -name '*.[ao]' -o -name '*.so' | xargs rm -f
Marc Bouchere6869a82000-03-20 06:03:29 +000012
13install: all $(EXTRA_INSTALLS)
Rusty Russell7fef1942001-01-08 07:44:46 +000014 @if [ -f /usr/local/bin/iptables -a "$(BINDIR)" = "/usr/local/sbin" ];\
15 then echo 'Erasing iptables from old location (now /usr/local/sbin).';\
16 rm -f /usr/local/bin/iptables;\
17 fi
Marc Bouchere6869a82000-03-20 06:03:29 +000018
Rusty Russell01c45202001-01-07 06:50:31 +000019install-experimental: $(EXTRA_INSTALLS_EXP)
20
Marc Bouchere6869a82000-03-20 06:03:29 +000021TAGS:
22 @rm -f $@
23 find . -name '*.[ch]' | xargs etags -a
24
25dep: $(DEPFILES) $(EXTRA_DEPENDS)
26 @echo Dependencies will be generated on next make.
Rusty Russell5622f212000-05-02 16:42:09 +000027 rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
Marc Bouchere6869a82000-03-20 06:03:29 +000028
29$(SHARED_LIBS:%.so=%.d): %.d: %.c
30 @-$(CC) -M -MG $(CFLAGS) $< | \
Rusty Russell5622f212000-05-02 16:42:09 +000031 sed -e 's@^.*\.o:@$*.d $*_sh.o:@' > $@
Marc Bouchere6869a82000-03-20 06:03:29 +000032
33$(SHARED_LIBS): %.so : %_sh.o
Phil Oester7f5be622006-07-20 16:59:04 +000034 $(CC) -shared $(EXT_LDFLAGS) -o $@ $<
Marc Bouchere6869a82000-03-20 06:03:29 +000035
James Morrisc81a3f32006-05-24 16:11:58 +000036$(SHARED_SE_LIBS:%.so=%.d): %.d: %.c
37 @-$(CC) -M -MG $(CFLAGS) $< | \
38 sed -e 's@^.*\.o:@$*.d $*_sh.o:@' > $@
39
40$(SHARED_SE_LIBS): %.so : %_sh.o
41 $(LD) -shared $(EXT_LDFLAGS) -o $@ $< $(LDLIBS)
42
Marc Bouchere6869a82000-03-20 06:03:29 +000043%_sh.o : %.c
44 $(CC) $(SH_CFLAGS) -o $@ -c $<
45
Marc Bouchere6869a82000-03-20 06:03:29 +000046.makefirst:
47 @echo Making dependencies: please wait...
48 @touch .makefirst
49
Rusty Russell5622f212000-05-02 16:42:09 +000050# This is useful for when dependencies completely screwed
51%.h::
Patrick McHardyf8ec61f2006-04-28 08:09:07 +000052 @echo "Unable to resolve dependency on $@. Try 'make clean'."
Rusty Russellf4a6a0e2000-07-30 01:42:17 +000053 @-rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
54 @[ -d $(KERNEL_DIR)/include/linux/netfilter_ipv4 ] || echo -e '\n\n Please try `make KERNEL_DIR=path-to-correct-kernel'\'.'\n\n'
Rusty Russell5622f212000-05-02 16:42:09 +000055 @exit 1
56
Marc Bouchere6869a82000-03-20 06:03:29 +000057-include $(DEPFILES) $(EXTRA_DEPENDS)
58-include .makefirst