Skip to content

Commit

Permalink
Moved raddb/ to use boilermake
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Feb 26, 2013
1 parent 5283adb commit 448e18f
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 152 deletions.
25 changes: 0 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ export DESTDIR := $(R)
# And over-ride all of the other magic.
include scripts/boiler.mk

# These are not yet converted to the new system
SUBDIRS = $(wildcard raddb)

.PHONY: test
test:
@$(MAKE) -C raddb/certs
@$(MAKE) -C src/tests tests

#
# The $(R) is a magic variable not defined anywhere in this source.
Expand Down Expand Up @@ -56,10 +52,6 @@ install.bindir:
install.sbindir:
@[ -d $(R)$(sbindir) ] || $(INSTALL) -d -m 755 $(R)$(sbindir)

.PHONY: install.raddbdir
install.raddbdir:
@[ -d $(R)$(raddbdir) ] || $(INSTALL) -d -m 755 $(R)$(raddbdir)

.PHONY: install.dirs
install.dirs: install.bindir install.sbindir
@$(INSTALL) -d -m 755 $(R)$(mandir)
Expand All @@ -85,9 +77,6 @@ $(R)$(mandir)/%: man/%

install: install.dirs install.share install.man

install:
@$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common

ifneq ($(RADMIN),)
ifneq ($(RGROUP),)
.PHONY: install-chown
Expand All @@ -109,20 +98,6 @@ install-chown:
endif
endif

.PHONY: common $(SUBDIRS)

#
# We need to convert these directories to boilermake!
#
all:
@$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common

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 \
src/include/radpaths.h src/include/stamp-h \
Expand Down
2 changes: 1 addition & 1 deletion main.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SUBMAKEFILES := src/all.mk scripts/all.mk doc/all.mk
SUBMAKEFILES := src/all.mk scripts/all.mk doc/all.mk raddb/all.mk
120 changes: 0 additions & 120 deletions raddb/Makefile

This file was deleted.

107 changes: 107 additions & 0 deletions raddb/all.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# The list of files to install.
#
LOCAL_FILES := acct_users clients.conf dictionary templates.conf \
experimental.conf hints huntgroups \
preproxy_users proxy.conf radiusd.conf trigger.conf \
users README.rst

DEFAULT_SITES := default inner-tunnel
LOCAL_SITES := $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES))

DEFAULT_MODULES := always attr_filter attr_rewrite cache_eap chap checkval \
counter cui detail detail.log digest dhcp dynamic_clients eap \
echo exec expiration expr files inner-eap linelog logintime \
mschap ntlm_auth pap passwd preprocess radutmp realm \
replicate soh sradutmp unix utf8 wimax

LOCAL_MODULES := $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))

LOCAL_CERT_FILES := Makefile bootstrap README xpextensions \
ca.cnf server.cnf client.cnf

RADDB_DIRS := sites-available sites-enabled mods-available mods-enabled \
filter policy.d certs

# Installed directories
INSTALL_RADDB_DIRS := $(R)$(raddbdir)/ $(addprefix $(R)$(raddbdir)/, \
$(RADDB_DIRS) $(shell find raddb/sql -type d -print))

# Grab files from the various subdirectories
INSTALL_FILES := $(wildcard raddb/sites-available/* raddb/mods-available/*) \
$(LOCAL_SITES) $(LOCAL_MODULES) \
$(addprefix raddb/,$(LOCAL_FILES)) \
$(addprefix raddb/certs/,$(LOCAL_CERT_FILES)) \
$(wildcard raddb/policy.d/* raddb/filter/*) \
$(shell find raddb/sql -type f -print)


# Re-write local files to installed files, filtering out editor backups
INSTALL_RADDB := $(patsubst raddb/%,$(R)$(raddbdir)/%,\
$(filter-out %~,$(INSTALL_FILES)))

all: $(LOCAL_SITES) $(LOCAL_MODULES)

clean: clean.raddb

install: install.raddb

# Local build rules
raddb/sites-enabled mods-enabled:
@echo MKDIR $@
@mkdir -p $@

# Set up the default modules for running in-source builds
raddb/mods-enabled/%: raddb/mods-available/% | raddb/mods-enabled
@echo LN-S $@
@cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)

# Set up the default sites for running in-source builds
raddb/sites-enabled/%: raddb/sites-available/% | raddb/sites-enabled
@echo LN-S $@
@cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)

# Installation rules for directories. Note permissions are 750!
$(INSTALL_RADDB_DIRS):
@echo INSTALL $(patsubst $(R)$(raddbdir)%,raddb%,$@)
@$(INSTALL) -d -m 750 $@

# The installed files have ORDER dependencies. This means that they
# will be installed if the target doesn't exist. And they won't be
# installed if the target already exists, even if it is out of date.
#
# This dependency lets us install the server on top of an existing
# system, hopefully without breaking anything.

# Installation rules for mods-enabled. Note ORDER dependencies
$(R)$(raddbdir)/mods-enabled/%: | $(R)$(raddbdir)/mods-available/%
@cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)

# Installation rules for sites-enabled. Note ORDER dependencies
$(R)$(raddbdir)/sites-enabled/%: | $(R)$(raddbdir)/sites-available/%
@cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)

# Installation rules for plain modules.
$(R)$(raddbdir)/%: | raddb/%
@echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
@$(INSTALL) -m 640 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@

# Bootstrap is special
$(R)$(raddbdir)/certs/bootstrap: | raddb/certs/bootstrap
@echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
@$(INSTALL) -m 750 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@

# List directories before the file targets.
# It's not clear why GNU Make doesn't deal well with this.
install.raddb: $(INSTALL_RADDB_DIRS) $(INSTALL_RADDB)

clean.raddb:
@rm -f *~ $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES)) \
$(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))

#
# A handy target to find out which triggers are where.
# Should only be run by SNMP developers.
#
triggers:
@grep exec_trigger `find src -name "*.c" -print` | grep '"' | sed -e 's/.*,//' -e 's/ *"//' -e 's/");.*//'
4 changes: 2 additions & 2 deletions src/modules/rlm_perl/all.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ SOURCES := rlm_perl.c
SRC_CFLAGS := @perl_cflags@
TGT_LDLIBS := @perl_ldflags@

install: install.raddbdir $(R)$(raddbdir)/example.pl
install: $(R)$(raddbdir)/example.pl

$(R)$(raddbdir)/example.pl: src/modules/rlm_perl/example.pl
$(R)$(raddbdir)/example.pl: src/modules/rlm_perl/example.pl | $(R)$(raddbdir)/
@$(ECHO) INSTALL $(notdir $<)
@$(INSTALL) -m 755 $< $(R)$(raddbdir)/
4 changes: 2 additions & 2 deletions src/modules/rlm_python/all.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ SOURCES := $(TARGETNAME).c
TGT_LDLIBS := @python_ldflags@
SRC_CFLAGS := @python_cflags@

install: install.raddbdir $(R)$(raddbdir)/example.py
install: $(R)$(raddbdir)/example.py

$(R)$(raddbdir)/example.py: src/modules/rlm_python/example.py
$(R)$(raddbdir)/example.py: src/modules/rlm_python/example.py | $(R)$(raddbdir)/
@$(ECHO) INSTALL $(notdir $<)
@$(INSTALL) -m 755 $< $(R)$(raddbdir)/
4 changes: 2 additions & 2 deletions src/modules/rlm_ruby/all.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ SOURCES := $(TARGETNAME).c
SRC_CFLAGS := @ruby_cflags@
TGT_LDLIBS := @ruby_ldflags@

install: install.raddbdir $(R)$(raddbdir)/example.rb
install: $(R)$(raddbdir)/example.rb

$(R)$(raddbdir)/example.rb: src/modules/rlm_ruby/example.rb
$(R)$(raddbdir)/example.rb: src/modules/rlm_ruby/example.rb | $(R)$(raddbdir)/
@$(ECHO) INSTALL $(notdir $<)
@$(INSTALL) -m 755 $< $(R)$(raddbdir)/

0 comments on commit 448e18f

Please sign in to comment.