Fix typo
[freeradius.git] / src / modules / Makefile
1 #
2 # Makefile
3 #
4 # Version:      $Id$
5 #
6
7 include ../../Make.inc
8
9 WHAT_TO_MAKE    = all
10 MFLAGS += --no-print-directory
11
12 all:
13         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
14
15 install:
16         $(INSTALL) -d -m 755 $(R)$(libdir)
17         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
18
19 clean:
20         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
21         @rm -f *~ lib/rlm_* lib/*.o lib/smbencrypt lib/radeapclient
22
23 distclean:
24         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
25
26 # Requires GNU Make, but even older ones will do.
27 SUBDIRS := $(patsubst %/,%,$(dir $(wildcard $(addsuffix /Makefile,$(MODULES)))))
28
29 .PHONY: common libs $(SUBDIRS)
30
31 libs:
32         @[ -d lib/ ] || mkdir lib
33         @[ -d lib/.libs ] || mkdir lib/.libs
34
35 common: libs $(SUBDIRS)
36
37 $(SUBDIRS): 
38         @echo "Making $(WHAT_TO_MAKE) in $(X)modules/$@..."
39         @$(MAKE) $(MFLAGS) X=$(X)modules/ -C $@ $(WHAT_TO_MAKE)
40
41 # The rlm_*/*/* stuff is to catch the configure
42 CONFIG_FILES := $(wildcard rlm_*/configure.in rlm_*/*/*/configure.in)
43
44 .PHONY: reconfig $(CONFIG_FILES)
45
46 #
47 #  Do NOT use "common", because some modules may not be built,
48 #  and therefore their makefiles may be empty or non-existent.
49 #
50 ifeq "$(AUTOCONF)" ""
51 reconfig:
52         @echo autoconf is needed for this target
53 else
54 ifeq "$(AUTOHEADER)" ""
55 reconfig:
56         @echo autoheader is needed for this target
57 else
58 reconfig: $(CONFIG_FILES)
59 endif
60 endif
61
62 # Don't use: $(MAKE) -C $(dir $@) reconfig
63 # The modules may not have a Makefile
64 $(CONFIG_FILES):
65         @echo "Making reconfig in $(dir $@)..."
66         @cd $(dir $@) && $(AUTOCONF) -I ./m4 -I $(top_builddir) -I $(top_builddir)/m4
67         @if grep AC_CONFIG_HEADERS $@ >/dev/null; then\
68                 cd $(dir $@) && $(AUTOHEADER); \
69          fi