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.
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 = $(wildcard src raddb scripts doc)
62 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
65 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
68 ifeq "scripts/jlibtool" "$(JLIBTOOL)"
71 scripts/jlibtool: scripts/jlibtool.c
74 LIBTOOL := $(top_srcdir)/scripts/jlibtool
81 @$(MAKE) -C src/tests tests
84 # The $(R) is a magic variable not defined anywhere in this source.
85 # It's purpose is to allow an admin to create an installation 'tar'
86 # file *without* actually installing it. e.g.:
88 # $ R=/home/root/tmp make install
90 # $ tar -cf ~/freeradius-package.tar *
92 # The 'tar' file can then be un-tar'd on any similar machine. It's a
93 # cheap way of creating packages, without using a package manager.
94 # Many of the platform-specific packaging tools use the $(R) variable
95 # when creating their packages.
97 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
98 # we make sure DESTDIR is defined.
100 export DESTDIR := $(R)
101 ifeq "$(BOILERMAKE)" ""
103 $(INSTALL) -d -m 755 $(R)$(sbindir)
104 $(INSTALL) -d -m 755 $(R)$(bindir)
105 $(INSTALL) -d -m 755 $(R)$(raddbdir)
106 $(INSTALL) -d -m 755 $(R)$(mandir)
107 $(INSTALL) -d -m 755 $(R)$(RUNDIR)
108 $(INSTALL) -d -m 700 $(R)$(logdir)
109 $(INSTALL) -d -m 700 $(R)$(radacctdir)
110 $(INSTALL) -d -m 755 $(R)$(datadir)
111 $(INSTALL) -d -m 755 $(R)$(dictdir)
113 $(INSTALL) -d -m 755 $(R)$(mandir)/man$$i; \
114 for p in man/man$$i/*.$$i; do \
115 $(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \
118 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
119 @echo "Installing dictionary files in $(R)$(dictdir)"; \
121 for i in dictionary*; do \
122 $(INSTALL) -m 644 $$i $(R)$(dictdir); \
124 $(LIBTOOL) --finish $(R)$(libdir)
129 .PHONY: install-chown
131 chown -R $(RADMIN) $(R)$(raddbdir)
132 chgrp -R $(RGROUP) $(R)$(raddbdir)
133 chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
134 chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
135 chown -R $(RADMIN) $(R)$(logdir)
136 chgrp -R $(RGROUP) $(R)$(logdir)
137 find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
138 find $(R)$(logdir) -type d -exec chmod g+s {} \;
139 find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
140 chown -R $(RADMIN) $(R)$(RUNDIR)
141 chgrp -R $(RGROUP) $(R)$(RUNDIR)
142 find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
143 find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
144 find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
148 .PHONY: common $(SUBDIRS)
153 @echo "Making $(WHAT_TO_MAKE) in $@..."
154 @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
157 rm -f config.cache config.log config.status libtool \
158 src/include/radpaths.h src/include/stamp-h \
159 libltdl/config.log libltdl/config.status \
161 -find . ! -name configure.in -name \*.in -print | \
163 while read file; do rm -f $$file; done
164 -find src/modules -name config.mak | \
165 while read file; do rm -f $$file; done
166 -find src/modules -name config.h | \
167 while read file; do rm -f $$file; done
169 ######################################################################
171 # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
173 ######################################################################
176 @$(MAKE) $(MFLAGS) -C src reconfig
178 @$(MAKE) src/include/autoconf.h.in
180 configure: configure.in aclocal.m4
183 .PHONY: src/include/autoconf.h.in
184 src/include/autoconf.h.in:
187 config.status: configure
188 ./config.status --recheck
192 .PHONY: check-includes
194 scripts/min-includes.pl `find . -name "*.c" -print`
197 etags `find src -type f -name '*.[ch]' -print`
200 # Make test certificates.
204 @cd raddb/certs && $(MAKE)
206 ######################################################################
210 # Note that "Make.inc" has to be updated with the release number
211 # BEFORE running this command!
213 ######################################################################
214 freeradius-server-$(RADIUSD_VERSION).tar.gz: .git
215 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | gzip > $@
217 freeradius-server-$(RADIUSD_VERSION).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION).tar.gz
218 gpg --default-key aland@freeradius.org -b $<
220 freeradius-server-$(RADIUSD_VERSION).tar.bz2: .git
221 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | bzip2 > $@
223 freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION).tar.bz2
224 gpg --default-key aland@freeradius.org -b $<
228 dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
229 @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
230 cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > redhat/.foo; \
231 mv redhat/.foo redhat/freeradius.spec; \
232 echo redhat/freeradius.spec 'Version' needs to be updated; \
235 @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
236 cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > suse/.foo; \
237 mv suse/.foo suse/freeradius.spec; \
238 echo suse/freeradius.spec 'Version' needs to be updated; \
241 @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION)" ]; then \
242 echo debian/changelog needs to be updated; \
246 dist: dist-check freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
248 dist-sign: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig
250 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
251 scp $^ freeradius.org@ns5.freeradius.org:public_ftp
252 scp $^ freeradius.org@www.tr.freeradius.org:public_ftp
255 # Note that we do NOT do the tagging here! We just print out what
258 dist-tag: freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
259 @echo "git tag release_`echo $(RADIUSD_VERSION) | tr .- __`"
262 # Build a debian package
266 fakeroot dpkg-buildpackage -b -uc