X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=blobdiff_plain;f=Makefile;h=e8e37bcf214bb5cb7ac073d8b0cbee788f44036d;hp=c8aa7a50a1d0339d6c3e34f89b2333873ad67f43;hb=HEAD;hpb=d9318543eb60c89baf15bf033347270eb753f23e diff --git a/Makefile b/Makefile index c8aa7a5..e8e37bc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Makefile Makefile for the cistron-radius package. +# Makefile # # NOTE: This top-level Makefile must not # use GNU-make extensions. The lower ones can. @@ -9,7 +9,9 @@ include Make.inc -SUBDIRS = libltdl src raddb doc scripts +.PHONY: all clean install + +SUBDIRS = $(LTDL_SUBDIRS) $(wildcard src raddb scripts doc) WHAT_TO_MAKE = all all: @@ -19,37 +21,80 @@ clean: @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common @rm -f *~ +.PHONY: tests +tests: + @$(MAKE) -C src/tests tests + +# +# The $(R) is a magic variable not defined anywhere in this source. +# It's purpose is to allow an admin to create an installation 'tar' +# file *without* actually installing it. e.g.: +# +# $ R=/home/root/tmp make install +# $ cd /home/root/tmp +# $ tar -cf ~/freeradius-package.tar * +# +# The 'tar' file can then be un-tar'd on any similar machine. It's a +# cheap way of creating packages, without using a package manager. +# Many of the platform-specific packaging tools use the $(R) variable +# when creating their packages. +# +# For compatibility with typical GNU packages (e.g. as seen in libltdl), +# we make sure DESTDIR is defined. +# +export DESTDIR := $(R) install: - @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common - $(INSTALL) -d -m 755 $(R)$(mandir); + $(INSTALL) -d -m 755 $(R)$(sbindir) + $(INSTALL) -d -m 755 $(R)$(bindir) + $(INSTALL) -d -m 755 $(R)$(raddbdir) + $(INSTALL) -d -m 755 $(R)$(mandir) + $(INSTALL) -d -m 755 $(R)$(RUNDIR) + $(INSTALL) -d -m 700 $(R)$(logdir) + $(INSTALL) -d -m 700 $(R)$(radacctdir) + $(INSTALL) -d -m 755 $(R)$(datadir) + $(INSTALL) -d -m 755 $(R)$(dictdir) for i in 1 5 8; do \ $(INSTALL) -d -m 755 $(R)$(mandir)/man$$i; \ - $(INSTALL) -m 644 man/man$$i/*.$$i $(R)$(mandir)/man$$i; \ + for p in man/man$$i/*.$$i; do \ + $(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \ + done \ done - @echo "Creating/updating files in $(R)$(raddbdir)"; \ - $(INSTALL) -d -m 755 $(R)$(raddbdir); \ - cd raddb; \ - for i in [a-c]* [e-z]*; do \ - [ $$i != radiusd.conf.m4.in -a $$i != radiusd.conf.m4 -a ! -f $(R)$(raddbdir)/$$i ] && \ - $(INSTALL) -m 644 $$i $(R)$(raddbdir); \ - done; \ + @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common + @echo "Installing dictionary files in $(R)$(dictdir)"; \ + cd share; \ for i in dictionary*; do \ - [ ! -f $(R)$(raddbdir)/$$i ] && $(INSTALL) -m 644 $$i $(R)$(raddbdir); \ - if [ "`find $$i -newer $(R)$(raddbdir)/$$i`" ]; then \ - echo "** $(R)$(raddbdir)/$$i"; \ - nt=1; \ - fi; \ - done; \ - if [ "$$nt" ]; then \ - echo "** The samples in ../raddb are newer than these files";\ - echo "** Please investigate and copy manually if appropriate";\ - fi - -common: - @for dir in $(SUBDIRS); do \ - echo "Making $(WHAT_TO_MAKE) in $$dir..."; \ - (cd $$dir && $(MAKE) $(MFLAGS) $(WHAT_TO_MAKE)) || exit 1;\ + $(INSTALL) -m 644 $$i $(R)$(dictdir); \ done + $(LIBTOOL) --finish $(R)$(libdir) + +ifneq ($(RADMIN),) +ifneq ($(RGROUP),) +.PHONY: install-chown +install-chown: + chown -R $(RADMIN) $(R)$(raddbdir) + chgrp -R $(RGROUP) $(R)$(raddbdir) + chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print` + chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print` + chown -R $(RADMIN) $(R)$(logdir) + chgrp -R $(RGROUP) $(R)$(logdir) + find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \; + find $(R)$(logdir) -type d -exec chmod g+s {} \; + find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \; + chown -R $(RADMIN) $(R)$(RUNDIR) + chgrp -R $(RGROUP) $(R)$(RUNDIR) + find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \; + find $(R)$(RUNDIR) -type d -exec chmod g+s {} \; + find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \; +endif +endif + +.PHONY: common $(SUBDIRS) + +common: $(SUBDIRS) + +$(SUBDIRS): + @echo "Making $(WHAT_TO_MAKE) in $@..." + @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) distclean: clean rm -f config.cache config.log config.status libtool \ @@ -64,25 +109,20 @@ distclean: clean -find src/modules -name config.h | \ while read file; do rm -f $$file; done -ifndef prefix # catch runs without configuring, and give helpful advice. -Make.inc: - @echo " Sorry! You must run 'configure', before 'make'."; - @false -endif - ###################################################################### # # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking # ###################################################################### reconfig: configure src/include/autoconf.h.in + @$(MAKE) $(MFLAGS) -C src reconfig configure: configure.in aclocal.m4 $(AUTOCONF) # autoheader might not change autoconf.h.in, so touch a stamp file -src/include/autoconf.h.in: src/include/stamp-h.in acconfig.h -src/include/stamp-h.in: configure.in acconfig.h +src/include/autoconf.h.in: src/include/stamp-h.in +src/include/stamp-h.in: configure.in $(AUTOHEADER) echo timestamp > src/include/stamp-h.in @@ -94,3 +134,79 @@ config.status: configure ./config.status --recheck configure.in: + +.PHONY: check-includes +check-includes: + scripts/min-includes.pl `find . -name "*.c" -print` + +TAGS: + etags `find src -type f -name '*.[ch]' -print` + +# +# Make test certificates. +# +.PHONY: certs +certs: + @cd raddb/certs && $(MAKE) + +###################################################################### +# +# Make a release. +# +# Note that "Make.inc" has to be updated with the release number +# BEFORE running this command! +# +###################################################################### +freeradius-server-$(RADIUSD_VERSION).tar.gz: .git + git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | gzip > $@ + +freeradius-server-$(RADIUSD_VERSION).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION).tar.gz + gpg --default-key aland@freeradius.org -b $< + +freeradius-server-$(RADIUSD_VERSION).tar.bz2: .git + git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | bzip2 > $@ + +freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION).tar.bz2 + gpg --default-key aland@freeradius.org -b $< + +# high-level targets +.PHONY: dist-check +dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog + @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \ + cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > redhat/.foo; \ + mv redhat/.foo redhat/freeradius.spec; \ + echo redhat/freeradius.spec 'Version' needs to be updated; \ + exit 1; \ + fi + @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \ + cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > suse/.foo; \ + mv suse/.foo suse/freeradius.spec; \ + echo suse/freeradius.spec 'Version' needs to be updated; \ + exit 1; \ + fi + @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION)" ]; then \ + echo debian/changelog needs to be updated; \ + exit 1; \ + fi + +dist: dist-check freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2 + +dist-sign: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig + +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 + scp $^ freeradius.org@ns5.freeradius.org:public_ftp + scp $^ freeradius.org@www.tr.freeradius.org:public_ftp + +# +# Note that we do NOT do the tagging here! We just print out what +# to do! +# +dist-tag: freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2 + @echo "git tag release_`echo $(RADIUSD_VERSION) | tr .- __`" + +# +# Build a debian package +# +.PHONY: deb +deb: + fakeroot dpkg-buildpackage -b -uc