4 # NOTE: This top-level Makefile must not
5 # use GNU-make extensions. The lower ones can.
11 MFLAGS += --no-print-directory
13 # Speed up the build for developers. This means editing Make.inc,
14 # and adding "BOILER = yes" to the bottom. Once that's done, the
17 ifeq "$(BOILER)" "yes"
19 # Require at least GNU Make 3.81 for the new build system
20 # Don't allow 3.80. Allow any 3.8x. This will need to be changed
21 # in a decade or two when GNU Make 3.90 is released.
22 BOILERMAKE=$(subst 3.8,yes,$(subst 3.80,,$(MAKE_VERSION)))
24 # The version of GNU Make is too old, don't use it.
25 ifeq "" "$(findstring yes,$(BOILERMAKE))"
29 # Static-only builds still require libtool.
30 # This is because it does all kinds of preload magic in order
31 # to force the linker to put the libraries into the main binary.
32 # We don't support that yet, so we miss it...
33 ifneq "$(USE_SHARED_LIBS)" "yes"
38 # If possible, drastically decrease the build time.
39 # The new build system means that
40 ifneq "" "$(BOILERMAKE)"
42 # Don't use libtool or libltdl.
43 # They are a blight upon the face of the earth.
45 INCLTDL := -DWITH_DLOPEN
46 CFLAGS += -DWITHOUT_LIBLTDL
50 export DESTDIR := $(R)
52 # And over-ride all of the other magic.
53 include scripts/boiler.mk
56 .PHONY: all clean install
58 SUBDIRS = $(LTDL_SUBDIRS) $(wildcard src raddb scripts doc)
62 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
65 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
71 @$(MAKE) -C src/tests tests
74 # The $(R) is a magic variable not defined anywhere in this source.
75 # It's purpose is to allow an admin to create an installation 'tar'
76 # file *without* actually installing it. e.g.:
78 # $ R=/home/root/tmp make install
80 # $ tar -cf ~/freeradius-package.tar *
82 # The 'tar' file can then be un-tar'd on any similar machine. It's a
83 # cheap way of creating packages, without using a package manager.
84 # Many of the platform-specific packaging tools use the $(R) variable
85 # when creating their packages.
87 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
88 # we make sure DESTDIR is defined.
90 export DESTDIR := $(R)
91 ifeq "$(BOILERMAKE)" ""
93 $(INSTALL) -d -m 755 $(R)$(sbindir)
94 $(INSTALL) -d -m 755 $(R)$(bindir)
95 $(INSTALL) -d -m 755 $(R)$(raddbdir)
96 $(INSTALL) -d -m 755 $(R)$(mandir)
97 $(INSTALL) -d -m 755 $(R)$(RUNDIR)
98 $(INSTALL) -d -m 700 $(R)$(logdir)
99 $(INSTALL) -d -m 700 $(R)$(radacctdir)
100 $(INSTALL) -d -m 755 $(R)$(datadir)
101 $(INSTALL) -d -m 755 $(R)$(dictdir)
103 $(INSTALL) -d -m 755 $(R)$(mandir)/man$$i; \
104 for p in man/man$$i/*.$$i; do \
105 $(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \
108 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
109 @echo "Installing dictionary files in $(R)$(dictdir)"; \
111 for i in dictionary*; do \
112 $(INSTALL) -m 644 $$i $(R)$(dictdir); \
114 $(LIBTOOL) --finish $(R)$(libdir)
119 .PHONY: install-chown
121 chown -R $(RADMIN) $(R)$(raddbdir)
122 chgrp -R $(RGROUP) $(R)$(raddbdir)
123 chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
124 chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
125 chown -R $(RADMIN) $(R)$(logdir)
126 chgrp -R $(RGROUP) $(R)$(logdir)
127 find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
128 find $(R)$(logdir) -type d -exec chmod g+s {} \;
129 find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
130 chown -R $(RADMIN) $(R)$(RUNDIR)
131 chgrp -R $(RGROUP) $(R)$(RUNDIR)
132 find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
133 find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
134 find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
138 .PHONY: common $(SUBDIRS)
143 @echo "Making $(WHAT_TO_MAKE) in $@..."
144 @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
147 rm -f config.cache config.log config.status libtool \
148 src/include/radpaths.h src/include/stamp-h \
149 libltdl/config.log libltdl/config.status \
151 -find . ! -name configure.in -name \*.in -print | \
153 while read file; do rm -f $$file; done
154 -find src/modules -name config.mak | \
155 while read file; do rm -f $$file; done
156 -find src/modules -name config.h | \
157 while read file; do rm -f $$file; done
159 ######################################################################
161 # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
163 ######################################################################
166 @$(MAKE) $(MFLAGS) -C src reconfig
168 @$(MAKE) src/include/autoconf.h.in
170 configure: configure.in aclocal.m4
173 .PHONY: src/include/autoconf.h.in
174 src/include/autoconf.h.in:
177 config.status: configure
178 ./config.status --recheck
182 .PHONY: check-includes
184 scripts/min-includes.pl `find . -name "*.c" -print`
187 etags `find src -type f -name '*.[ch]' -print`
190 # Make test certificates.
194 @cd raddb/certs && $(MAKE)
196 ######################################################################
200 # Note that "Make.inc" has to be updated with the release number
201 # BEFORE running this command!
203 ######################################################################
204 freeradius-server-$(RADIUSD_VERSION).tar.gz: .git
205 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | gzip > $@
207 freeradius-server-$(RADIUSD_VERSION).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION).tar.gz
208 gpg --default-key aland@freeradius.org -b $<
210 freeradius-server-$(RADIUSD_VERSION).tar.bz2: .git
211 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | bzip2 > $@
213 freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION).tar.bz2
214 gpg --default-key aland@freeradius.org -b $<
218 dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
219 @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
220 cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > redhat/.foo; \
221 mv redhat/.foo redhat/freeradius.spec; \
222 echo redhat/freeradius.spec 'Version' needs to be updated; \
225 @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
226 cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > suse/.foo; \
227 mv suse/.foo suse/freeradius.spec; \
228 echo suse/freeradius.spec 'Version' needs to be updated; \
231 @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION)" ]; then \
232 echo debian/changelog needs to be updated; \
236 dist: dist-check freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
238 dist-sign: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig
240 dist-publish: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2 freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig
241 scp $^ freeradius.org@ns5.freeradius.org:public_ftp
242 scp $^ freeradius.org@www.tr.freeradius.org:public_ftp
245 # Note that we do NOT do the tagging here! We just print out what
248 dist-tag: freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
249 @echo "git tag release_`echo $(RADIUSD_VERSION) | tr .- __`"
252 # Build a debian package
256 fakeroot dpkg-buildpackage -b -uc