blob: 56b482a911b005d9d7cd19b6e9635cf319d8eb2a [file] [log] [blame]
Marc Bouchere6869a82000-03-20 06:03:29 +00001#! /usr/bin/make
2
3all: $(SHARED_LIBS) $(EXTRAS)
4
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)
Rusty Russell80daae12001-01-08 08:36:31 +00009 rm -f $(SHARED_LIBS) $(EXTRAS) $(EXTRAS_EXP) $(SHARED_LIBS:%.so=%_sh.o)
Rusty Russellcc625ba2001-01-14 12:35:28 +000010 @find . -name '*.[ao]' -name '*.so' | xargs rm -f
Marc Bouchere6869a82000-03-20 06:03:29 +000011
12install: all $(EXTRA_INSTALLS)
Rusty Russell7fef1942001-01-08 07:44:46 +000013 @if [ -f /usr/local/bin/iptables -a "$(BINDIR)" = "/usr/local/sbin" ];\
14 then echo 'Erasing iptables from old location (now /usr/local/sbin).';\
15 rm -f /usr/local/bin/iptables;\
16 fi
Marc Bouchere6869a82000-03-20 06:03:29 +000017
Rusty Russell01c45202001-01-07 06:50:31 +000018install-experimental: $(EXTRA_INSTALLS_EXP)
19
Marc Bouchere6869a82000-03-20 06:03:29 +000020TAGS:
21 @rm -f $@
22 find . -name '*.[ch]' | xargs etags -a
23
24dep: $(DEPFILES) $(EXTRA_DEPENDS)
25 @echo Dependencies will be generated on next make.
Rusty Russell5622f212000-05-02 16:42:09 +000026 rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
Marc Bouchere6869a82000-03-20 06:03:29 +000027
28$(SHARED_LIBS:%.so=%.d): %.d: %.c
29 @-$(CC) -M -MG $(CFLAGS) $< | \
Rusty Russell5622f212000-05-02 16:42:09 +000030 sed -e 's@^.*\.o:@$*.d $*_sh.o:@' > $@
Marc Bouchere6869a82000-03-20 06:03:29 +000031
32$(SHARED_LIBS): %.so : %_sh.o
33 $(LD) -shared -o $@ $<
34
35%_sh.o : %.c
36 $(CC) $(SH_CFLAGS) -o $@ -c $<
37
Marc Bouchere6869a82000-03-20 06:03:29 +000038.makefirst:
39 @echo Making dependencies: please wait...
40 @touch .makefirst
41
Rusty Russell5622f212000-05-02 16:42:09 +000042# This is useful for when dependencies completely screwed
43%.h::
44 @echo Something wrong... deleting dependencies.
Rusty Russellf4a6a0e2000-07-30 01:42:17 +000045 @-rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
46 @[ -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 +000047 @exit 1
48
Marc Bouchere6869a82000-03-20 06:03:29 +000049-include $(DEPFILES) $(EXTRA_DEPENDS)
50-include .makefirst