print out why we couldn't parse the expiry time
[freeradius.git] / raddb / all.mk
1 #
2 #  The list of files to install.
3 #
4 LOCAL_FILES :=          clients.conf dictionary templates.conf experimental.conf \
5                         proxy.conf radiusd.conf trigger.conf README.rst panic.gdb
6
7 DEFAULT_SITES :=        default inner-tunnel
8 LOCAL_SITES :=          $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES))
9
10 DEFAULT_MODULES :=      always attr_filter cache_eap chap date \
11                         detail detail.log digest dhcp dynamic_clients eap \
12                         echo exec expiration expr files linelog logintime \
13                         mschap ntlm_auth pap passwd preprocess radutmp realm \
14                         replicate soh sradutmp unix unpack utf8
15
16 LOCAL_MODULES :=        $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
17
18 LOCAL_CERT_FILES :=     Makefile README xpextensions \
19                         ca.cnf server.cnf client.cnf bootstrap
20
21 #
22 #  We don't create the installed certs if we're building a package,
23 #  OR if OpenSSL is not available.
24 #
25 ifeq "$(PACKAGE)" ""
26 ifneq "$(OPENSSL_LIBS)" ""
27 LOCAL_CERT_PRODUCTS :=  $(addprefix $(R)$(raddbdir)/certs/,ca.key ca.pem \
28                         client.key client.pem server.key server.pem)
29 endif
30 endif
31
32 LEGACY_LINKS :=         $(addprefix $(R)$(raddbdir)/,users huntgroups hints)
33
34 RADDB_DIRS :=           certs mods-available mods-enabled policy.d \
35                         sites-available sites-enabled \
36                         $(patsubst raddb/%,%,$(shell find raddb/mods-config -type d -print))
37
38 # Installed directories
39 INSTALL_RADDB_DIRS :=   $(R)$(raddbdir)/ $(addprefix $(R)$(raddbdir)/, $(RADDB_DIRS))
40
41 # Grab files from the various subdirectories
42 INSTALL_FILES :=        $(wildcard raddb/sites-available/* raddb/mods-available/*) \
43                         $(addprefix raddb/,$(LOCAL_FILES)) \
44                         $(addprefix raddb/certs/,$(LOCAL_CERT_FILES)) \
45                         $(shell find raddb/mods-config -type f -print) \
46                         $(shell find raddb/policy.d -type f -print)
47
48 # Re-write local files to installed files, filtering out editor backups
49 INSTALL_RADDB :=        $(patsubst raddb/%,$(R)$(raddbdir)/%,\
50                         $(filter-out %~,$(INSTALL_FILES)))
51
52 all: build.raddb
53
54 build.raddb: $(LOCAL_SITES) $(LOCAL_MODULES)
55
56 clean: clean.raddb
57
58 install: install.raddb
59
60 # Local build rules
61 raddb/sites-enabled raddb/mods-enabled:
62         @echo INSTALL $@
63         @$(INSTALL) -d -m 750 $@
64
65 # Set up the default modules for running in-source builds
66 raddb/mods-enabled/%: raddb/mods-available/% | raddb/mods-enabled
67         @echo "LN-S $@"
68         @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
69
70 # Set up the default sites for running in-source builds
71 raddb/sites-enabled/%: raddb/sites-available/% | raddb/sites-enabled
72         @echo "LN-S $@"
73         @cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)
74
75 # Installation rules for directories.  Note permissions are 750!
76 $(INSTALL_RADDB_DIRS):
77         @echo INSTALL $(patsubst $(R)$(raddbdir)%,raddb%,$@)
78         @$(INSTALL) -d -m 750 $@
79
80 #  The installed files have ORDER dependencies.  This means that they
81 #  will be installed if the target doesn't exist.  And they won't be
82 #  installed if the target already exists, even if it is out of date.
83 #
84 #  This dependency lets us install the server on top of an existing
85 #  system, hopefully without breaking anything.
86
87 ifeq "$(wildcard $(R)$(raddbdir)/mods-available/)" ""
88 INSTALL_RADDB +=        $(patsubst raddb/%,$(R)$(raddbdir)/%,\
89                         $(filter-out %~,$(LOCAL_MODULES)))
90
91 # Installation rules for mods-enabled.  Note ORDER dependencies
92 $(R)$(raddbdir)/mods-enabled/%: | $(R)$(raddbdir)/mods-available/%
93         @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
94 endif
95
96 ifeq "$(wildcard $(R)$(raddbdir)/sites-available/)" ""
97 INSTALL_RADDB +=        $(patsubst raddb/%,$(R)$(raddbdir)/%,\
98                         $(filter-out %~,$(LOCAL_SITES)))
99
100 # Installation rules for sites-enabled.  Note ORDER dependencies
101 $(R)$(raddbdir)/sites-enabled/%: | $(R)$(raddbdir)/sites-available/%
102         @cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)
103 endif
104
105 # Installation rules for plain modules.
106 $(R)$(raddbdir)/%: | raddb/%
107         @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
108         @$(INSTALL) -m 640 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
109
110 # Create symbolic links for legacy files
111 $(R)$(raddbdir)/huntgroups: $(R)$(modconfdir)/preprocess/huntgroups
112         @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
113         @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
114
115 $(R)$(raddbdir)/hints: $(R)$(modconfdir)/preprocess/hints
116         @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
117         @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
118
119 $(R)$(raddbdir)/users: $(R)$(modconfdir)/files/authorize
120         @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
121         @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
122
123 ifneq "$(LOCAL_CERT_PRODUCTS)" ""
124 $(LOCAL_CERT_PRODUCTS):
125         @echo BOOTSTRAP raddb/certs/
126         @$(MAKE) -C $(R)$(raddbdir)/certs/
127
128 # Bootstrap is special
129 $(R)$(raddbdir)/certs/bootstrap: | raddb/certs/bootstrap $(LOCAL_CERT_PRODUCTS)
130         @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
131         @$(INSTALL) -m 750 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
132 else
133 $(R)$(raddbdir)/certs/bootstrap:
134         @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
135         @$(INSTALL) -m 750 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
136 endif
137
138 #  List directories before the file targets.
139 #  It's not clear why GNU Make doesn't deal well with this.
140 install.raddb: | $(INSTALL_RADDB_DIRS) $(INSTALL_RADDB) $(LEGACY_LINKS)
141
142 clean.raddb:
143         @rm -f *~ $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES)) \
144                 $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
145
146 #
147 #  A handy target to find out which triggers are where.
148 #  Should only be run by SNMP developers.
149 #
150 triggers:
151         @grep exec_trigger `find src -name "*.c" -print` | grep '"' | sed -e 's/.*,//' -e 's/ *"//' -e 's/");.*//'