update libtool and libltdl to 1.5.22, and improve the integration
[freeradius.git] / Makefile
1 #
2 # Makefile
3 #
4 #               NOTE: This top-level Makefile must not
5 #               use GNU-make extensions. The lower ones can.
6 #
7 # Version:      $Id$
8 #
9
10 include Make.inc
11
12 .PHONY: all clean install
13
14 SUBDIRS         = $(LTDL_SUBDIRS) src raddb scripts doc
15 WHAT_TO_MAKE    = all
16
17 all:
18         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
19
20 clean:
21         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
22         @rm -f *~
23
24 #
25 # The $(R) is a magic variable not defined anywhere in this source.
26 # It's purpose is to allow an admin to create an installation 'tar'
27 # file *without* actually installing it.  e.g.:
28 #
29 #  $ R=/home/root/tmp make install
30 #  $ cd /home/root/tmp
31 #  $ tar -cf ~/freeradius-package.tar *
32 #
33 # The 'tar' file can then be un-tar'd on any similar machine.  It's a
34 # cheap way of creating packages, without using a package manager.
35 # Many of the platform-specific packaging tools use the $(R) variable
36 # when creating their packages.
37 #
38 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
39 # we make sure DESTDIR is defined.
40 #
41 export DESTDIR := $(R)
42 install:
43         $(INSTALL) -d -m 755    $(R)$(sbindir)
44         $(INSTALL) -d -m 755    $(R)$(bindir)
45         $(INSTALL) -d -m 755    $(R)$(raddbdir)
46         $(INSTALL) -d -m 755    $(R)$(mandir)
47         $(INSTALL) -d -m 755    $(R)$(RUNDIR)
48         $(INSTALL) -d -m 700    $(R)$(logdir)
49         $(INSTALL) -d -m 700    $(R)$(radacctdir)
50         $(INSTALL) -d -m 755    $(R)$(datadir)
51         $(INSTALL) -d -m 755    $(R)$(dictdir)
52         for i in 1 5 8; do \
53                 $(INSTALL) -d -m 755    $(R)$(mandir)/man$$i; \
54                 for p in man/man$$i/*.$$i; do \
55                         $(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \
56                 done \
57         done
58         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
59         @echo "Installing dictionary files in $(R)$(dictdir)"; \
60         cd share; \
61         for i in dictionary*; do \
62                 $(INSTALL) -m 644 $$i $(R)$(dictdir); \
63         done
64         $(LIBTOOL) --finish $(R)$(libdir)
65
66 common:
67         @for dir in $(SUBDIRS); do \
68                 echo "Making $(WHAT_TO_MAKE) in $$dir..."; \
69                 $(MAKE) $(MFLAGS) -C $$dir $(WHAT_TO_MAKE) || exit $$?; \
70         done
71
72 distclean: clean
73         rm -f config.cache config.log config.status libtool \
74                 src/include/radpaths.h src/include/stamp-h \
75                 libltdl/config.log libltdl/config.status \
76                 libltdl/libtool
77         -find . ! -name configure.in -name \*.in -print | \
78                 sed 's/\.in$$//' | \
79                 while read file; do rm -f $$file; done
80         -find src/modules -name config.mak | \
81                 while read file; do rm -f $$file; done
82         -find src/modules -name config.h | \
83                 while read file; do rm -f $$file; done
84
85 ######################################################################
86 #
87 #  Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
88 #
89 ######################################################################
90 reconfig: configure src/include/autoconf.h.in
91
92 configure: configure.in aclocal.m4
93         $(AUTOCONF)
94
95 # autoheader might not change autoconf.h.in, so touch a stamp file
96 src/include/autoconf.h.in: src/include/stamp-h.in acconfig.h
97 src/include/stamp-h.in: configure.in acconfig.h
98         $(AUTOHEADER)
99         echo timestamp > src/include/stamp-h.in
100
101 src/include/autoconf.h: src/include/stamp-h
102 src/include/stamp-h: src/include/autoconf.h.in config.status
103         ./config.status
104
105 config.status: configure
106         ./config.status --recheck
107
108 configure.in:
109
110 TAGS:
111         etags `find src -type f -name '*.[ch]' -print`