blob: d76ac630642b96a982ad2da56d13d76cfd163595 [file] [log] [blame]
Marc Bouchere6869a82000-03-20 06:03:29 +00001#! /usr/bin/make
2
3all: $(SHARED_LIBS) $(EXTRAS)
4
Rusty Russell52451822000-08-27 07:47:46 +00005# Have to handle extensions which no longer exist.
Marc Bouchere6869a82000-03-20 06:03:29 +00006clean: $(EXTRA_CLEANS)
7 rm -f $(SHARED_LIBS) $(EXTRAS) $(SHARED_LIBS:%.so=%_sh.o)
Rusty Russell52451822000-08-27 07:47:46 +00008 @find . -name '*.[ao]' | xargs rm -f
Marc Bouchere6869a82000-03-20 06:03:29 +00009
10install: all $(EXTRA_INSTALLS)
11
12TAGS:
13 @rm -f $@
14 find . -name '*.[ch]' | xargs etags -a
15
16dep: $(DEPFILES) $(EXTRA_DEPENDS)
17 @echo Dependencies will be generated on next make.
Rusty Russell5622f212000-05-02 16:42:09 +000018 rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
Marc Bouchere6869a82000-03-20 06:03:29 +000019
20$(SHARED_LIBS:%.so=%.d): %.d: %.c
21 @-$(CC) -M -MG $(CFLAGS) $< | \
Rusty Russell5622f212000-05-02 16:42:09 +000022 sed -e 's@^.*\.o:@$*.d $*_sh.o:@' > $@
Marc Bouchere6869a82000-03-20 06:03:29 +000023
24$(SHARED_LIBS): %.so : %_sh.o
25 $(LD) -shared -o $@ $<
26
27%_sh.o : %.c
28 $(CC) $(SH_CFLAGS) -o $@ -c $<
29
Marc Bouchere6869a82000-03-20 06:03:29 +000030.makefirst:
31 @echo Making dependencies: please wait...
32 @touch .makefirst
33
Rusty Russell5622f212000-05-02 16:42:09 +000034# This is useful for when dependencies completely screwed
35%.h::
36 @echo Something wrong... deleting dependencies.
Rusty Russellf4a6a0e2000-07-30 01:42:17 +000037 @-rm -f $(DEPFILES) $(EXTRA_DEPENDS) .makefirst
38 @[ -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 +000039 @exit 1
40
Marc Bouchere6869a82000-03-20 06:03:29 +000041-include $(DEPFILES) $(EXTRA_DEPENDS)
42-include .makefirst