Port fix for bug #419 from branch_1_1
[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         = ${LIBLTDLPATH} 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 install:
39         $(INSTALL) -d -m 755    $(R)$(sbindir)
40         $(INSTALL) -d -m 755    $(R)$(bindir)
41         $(INSTALL) -d -m 755    $(R)$(raddbdir)
42         $(INSTALL) -d -m 755    $(R)$(mandir)
43         $(INSTALL) -d -m 755    $(R)$(RUNDIR)
44         $(INSTALL) -d -m 700    $(R)$(logdir)
45         $(INSTALL) -d -m 700    $(R)$(radacctdir)
46         $(INSTALL) -d -m 755    $(R)$(datadir)
47         $(INSTALL) -d -m 755    $(R)$(dictdir)
48         for i in 1 5 8; do \
49                 $(INSTALL) -d -m 755    $(R)$(mandir)/man$$i; \
50                 for p in man/man$$i/*.$$i; do \
51                         $(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \
52                 done \
53         done
54         @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
55         @echo "Installing dictionary files in $(R)$(dictdir)"; \
56         cd share; \
57         for i in dictionary*; do \
58                 $(INSTALL) -m 644 $$i $(R)$(dictdir); \
59         done
60         $(LIBTOOL) --finish $(R)$(libdir)
61
62 common:
63         @for dir in $(SUBDIRS); do \
64                 echo "Making $(WHAT_TO_MAKE) in $$dir..."; \
65                 $(MAKE) $(MFLAGS) -C $$dir $(WHAT_TO_MAKE) || exit $$?; \
66         done
67
68 distclean: clean
69         rm -f config.cache config.log config.status libtool \
70                 src/include/radpaths.h src/include/stamp-h \
71                 libltdl/config.log libltdl/config.status \
72                 libltdl/libtool
73         -find . ! -name configure.in -name \*.in -print | \
74                 sed 's/\.in$$//' | \
75                 while read file; do rm -f $$file; done
76         -find src/modules -name config.mak | \
77                 while read file; do rm -f $$file; done
78         -find src/modules -name config.h | \
79                 while read file; do rm -f $$file; done
80
81 ######################################################################
82 #
83 #  Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
84 #
85 ######################################################################
86 reconfig: configure src/include/autoconf.h.in
87
88 configure: configure.in aclocal.m4
89         $(AUTOCONF)
90
91 # autoheader might not change autoconf.h.in, so touch a stamp file
92 src/include/autoconf.h.in: src/include/stamp-h.in acconfig.h
93 src/include/stamp-h.in: configure.in acconfig.h
94         $(AUTOHEADER)
95         echo timestamp > src/include/stamp-h.in
96
97 src/include/autoconf.h: src/include/stamp-h
98 src/include/stamp-h: src/include/autoconf.h.in config.status
99         ./config.status
100
101 config.status: configure
102         ./config.status --recheck
103
104 configure.in:
105
106 .PHONY: check-includes
107 check-includes:
108         scripts/min-includes.pl `find . -name "*.c" -print`
109
110 TAGS:
111         etags `find src -type f -name '*.[ch]' -print`