4 # NOTE: This top-level Makefile must not
5 # use GNU-make extensions. The lower ones can.
12 .PHONY: all clean install
14 SUBDIRS = $(LTDL_SUBDIRS) $(wildcard src raddb scripts doc)
18 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
21 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
26 @$(MAKE) -C src/tests tests
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.:
33 # $ R=/home/root/tmp make install
35 # $ tar -cf ~/freeradius-package.tar *
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.
42 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
43 # we make sure DESTDIR is defined.
45 export DESTDIR := $(R)
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)
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; \
62 @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
63 @echo "Installing dictionary files in $(R)$(dictdir)"; \
65 for i in dictionary*; do \
66 $(INSTALL) -m 644 $$i $(R)$(dictdir); \
68 $(LIBTOOL) --finish $(R)$(libdir)
74 chown -R $(RADMIN) $(R)$(raddbdir)
75 chgrp -R $(RGROUP) $(R)$(raddbdir)
76 chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
77 chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
78 chown -R $(RADMIN) $(R)$(logdir)
79 chgrp -R $(RGROUP) $(R)$(logdir)
80 find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
81 find $(R)$(logdir) -type d -exec chmod g+s {} \;
82 find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
83 chown -R $(RADMIN) $(R)$(RUNDIR)
84 chgrp -R $(RGROUP) $(R)$(RUNDIR)
85 find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
86 find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
87 find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
91 .PHONY: common $(SUBDIRS)
96 @echo "Making $(WHAT_TO_MAKE) in $@..."
97 @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
100 rm -f config.cache config.log config.status libtool \
101 src/include/radpaths.h src/include/stamp-h \
102 libltdl/config.log libltdl/config.status \
104 -find . ! -name configure.in -name \*.in -print | \
106 while read file; do rm -f $$file; done
107 -find src/modules -name config.mak | \
108 while read file; do rm -f $$file; done
109 -find src/modules -name config.h | \
110 while read file; do rm -f $$file; done
112 ######################################################################
114 # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
116 ######################################################################
119 @$(MAKE) $(MFLAGS) -C src reconfig
121 @$(MAKE) src/include/autoconf.h.in
123 configure: configure.in aclocal.m4
126 .PHONY: src/include/autoconf.h.in
127 src/include/autoconf.h.in:
130 config.status: configure
131 ./config.status --recheck
135 .PHONY: check-includes
137 scripts/min-includes.pl `find . -name "*.c" -print`
140 etags `find src -type f -name '*.[ch]' -print`
143 # Make test certificates.
147 @cd raddb/certs && $(MAKE)
149 ######################################################################
153 # Note that "Make.inc" has to be updated with the release number
154 # BEFORE running this command!
156 ######################################################################
157 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz: .git
158 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ v2.1.x | gzip > $@
160 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz
161 gpg --default-key aland@freeradius.org -b $<
163 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: .git
164 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ v2.1.x | bzip2 > $@
166 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
167 gpg --default-key aland@freeradius.org -b $<
171 dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
172 @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
173 cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > redhat/.foo; \
174 mv redhat/.foo redhat/freeradius.spec; \
175 echo redhat/freeradius.spec 'Version' needs to be updated; \
178 @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
179 cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > suse/.foo; \
180 mv suse/.foo suse/freeradius.spec; \
181 echo suse/freeradius.spec 'Version' needs to be updated; \
184 @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/\+.*).*//;s/-1).*//;'` != "$(RADIUSD_VERSION_STRING)" ]; then \
185 echo debian/changelog needs to be updated; \
189 dist: dist-check freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
191 dist-sign: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig
193 dist-publish: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig
194 scp $^ freeradius.org@ftp.freeradius.org:public_ftp
195 # scp $^ freeradius.org@www.tr.freeradius.org:public_ftp
198 # Note that we do NOT do the tagging here! We just print out what
201 dist-tag: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
202 @echo "git tag release_`echo $(RADIUSD_VERSION_STRING) | tr .- __`"
205 # Build a debian package
209 fakeroot dpkg-buildpackage -b -uc