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