forked from inverse-inc/packetfence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
197 lines (147 loc) · 5.91 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
DOCBOOK_XSL := /usr/share/xml/docbook/stylesheet/docbook-xsl
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
DOCBOOK_XSL := /opt/local/share/xsl/docbook-xsl
else ifneq ("$(wildcard /etc/redhat-release)","")
DOCBOOK_XSL := /usr/share/sgml/docbook/xsl-stylesheets
endif
all:
@echo "Please chose which documentation to build:"
@echo ""
@echo " 'pdf' will build all guides using the PDF format"
@echo " 'PacketFence_Installation_Guide.pdf' will build the Installation guide in PDF"
@echo " 'PacketFence_Clustering_Guide.pdf' will build the Clustering guide in PDF"
@echo " 'PacketFence_Developers_Guide.pdf' will build the Developers guide in PDF"
@echo " 'PacketFence_Network_Devices_Configuration_Guide.pdf' will build the Network Devices Configuration guide in PDF"
ASCIIDOCS := $(notdir $(wildcard docs/PacketFence_*.asciidoc))
PDFS = $(patsubst %.asciidoc,docs/%.pdf, $(ASCIIDOCS))
docs/docbook/xsl/titlepage-fo.xsl: docs/docbook/xsl/titlepage-fo.xml
xsltproc \
-o docs/docbook/xsl/titlepage-fo.xsl \
$(DOCBOOK_XSL)/template/titlepage.xsl \
docs/docbook/xsl/titlepage-fo.xml
docs/docbook/xsl/import-fo.xsl:
@echo "<?xml version='1.0'?> \
<xsl:stylesheet \
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \
xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" \
version=\"1.0\"> \
<xsl:import href=\"${DOCBOOK_XSL}/fo/docbook.xsl\"/> \
</xsl:stylesheet>" \
> docs/docbook/xsl/import-fo.xsl
docs/%.pdf : docs/%.asciidoc docs/docbook/xsl/titlepage-fo.xsl docs/docbook/xsl/import-fo.xsl
asciidoc \
-a docinfo2 \
-b docbook \
-d book \
-f docs/docbook/docbook45.conf \
-o docs/docbook/$(notdir $<).docbook \
$<
xsltproc \
-o $<.fo \
docs/docbook/xsl/packetfence-fo.xsl \
docs/docbook/$(notdir $<).docbook
fop \
-c docs/fonts/fop-config.xml \
$<.fo \
-pdf $@
.PHONY: pdf
pdf: $(PDFS)
HTML = $(patsubst %.asciidoc,docs/html/%.html, $(ASCIIDOCS))
docs/html/%.html: docs/%.asciidoc
asciidoctor \
-D docs/html \
-n \
-r ./docs/html/asciidoctor-html.rb \
-a imagesdir=../images \
-a stylesdir=../html/pfappserver/root/static.alt/dist/css \
-a stylesheet=$(notdir $(wildcard ./html/pfappserver/root/static.alt/dist/css/app*.css)) \
$<
html/pfappserver/root/static/doc:
make html
mkdir html/pfappserver/root/static/doc
mkdir html/pfappserver/root/static/images
cp -a docs/html/* html/pfappserver/root/static/doc
cp -a docs/images/* html/pfappserver/root/static/images
docs/html/index.js: $(HTML)
find $$(dirname "$@") -type f -iname '*.html' -printf "{\"name\":\"%f\", \"size\":%s, \"last_modifed\" : %T@}\n" | jq -s '{ items: [ .[] | {name, size, last_modifed : (.last_modifed*1000 | floor)} ] }' > $@
.PHONY: html
html: $(HTML) docs/html/index.js
pfcmd.help:
/usr/local/pf/bin/pfcmd help > docs/pfcmd.help
.PHONY: configurations
configurations: SHELL:=/bin/bash
configurations:
find -type f -name '*.example' -print0 | while read -d $$'\0' file; do cp -n $$file "$$(dirname $$file)/$$(basename $$file .example)"; done
touch /usr/local/pf/conf/pf.conf
.PHONY: configurations_force
configurations_hard: SHELL:=/bin/bash
configurations_hard:
find -type f -name '*.example' -print0 | while read -d $$'\0' file; do cp $$file "$$(dirname $$file)/$$(basename $$file .example)"; done
touch /usr/local/pf/conf/pf.conf
# server certs and keys
# the | in the prerequisites ensure the target is not created if it already exists
# see https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types
conf/ssl/server.pem: | conf/ssl/server.key conf/ssl/server.crt conf/ssl/server.pem
cat conf/ssl/server.crt conf/ssl/server.key > conf/ssl/server.pem
conf/ssl/server.crt: | conf/ssl/server.crt
openssl req -new -x509 -days 365 \
-out /usr/local/pf/conf/ssl/server.crt \
-key /usr/local/pf/conf/ssl/server.key \
-config /usr/local/pf/conf/openssl.cnf
conf/ssl/server.key: | conf/ssl/server.key
openssl genrsa -out /usr/local/pf/conf/ssl/server.key 2048
conf/local_secret:
date +%s | sha256sum | base64 | head -c 32 > /usr/local/pf/conf/local_secret
conf/unified_api_system_pass:
date +%s | sha256sum | base64 | head -c 32 > /usr/local/pf/conf/unified_api_system_pass
conf/currently-at: conf/pf-release
cat conf/pf-release > conf/currently-at
bin/pfcmd: src/pfcmd.c
$(CC) -O2 -g -std=c99 -Wall $< -o $@
bin/ntlm_auth_wrapper: src/ntlm_auth_wrap.c
cc -g -std=c99 -Wall src/ntlm_auth_wrap.c -o bin/ntlm_auth_wrapper
.PHONY:permissions
/etc/sudoers.d/packetfence.sudoers: packetfence.sudoers
cp packetfence.sudoers /etc/sudoers.d/packetfence
.PHONY: sudo
sudo: /etc/sudoers.d/packetfence.sudoers
permissions: bin/pfcmd
./bin/pfcmd fixpermissions
raddb/certs/server.crt:
cd raddb/certs; make
.PHONY: raddb-sites-enabled
raddb/sites-enabled:
mkdir raddb/sites-enabled
cd raddb/sites-enabled;\
for f in packetfence packetfence-tunnel dynamic-clients status;\
do ln -s ../sites-available/$$f $$f;\
done
.PHONY: translation
translation:
for TRANSLATION in de en es fr he_IL it nl pl_PL pt_BR; do\
/usr/bin/msgfmt conf/locale/$$TRANSLATION/LC_MESSAGES/packetfence.po\
--output-file conf/locale/$$TRANSLATION/LC_MESSAGES/packetfence.mo;\
done
.PHONY: mysql-schema
mysql-schema:
ln -f -s /usr/local/pf/db/pf-schema-X.Y.Z.sql /usr/local/pf/db/pf-schema.sql;
.PHONY: chown_pf
chown_pf:
chown -R pf:pf *
.PHONY: fingerbank
fingerbank:
rm -f /usr/local/pf/lib/fingerbank
ln -s /usr/local/fingerbank/lib/fingerbank /usr/local/pf/lib/fingerbank \
.PHONY: systemd
systemd:
cp /usr/local/pf/conf/systemd/packetfence* /usr/lib/systemd/system/
systemctl daemon-reload
.PHONY: pf-dal
pf-dal:
perl /usr/local/pf/addons/dev-helpers/bin/generator-data-access-layer.pl
devel: configurations conf/ssl/server.key conf/ssl/server.crt conf/local_secret bin/pfcmd raddb/certs/server.crt sudo translation mysql-schema raddb/sites-enabled fingerbank chown_pf permissions bin/ntlm_auth_wrapper conf/unified_api_system_pass
test:
cd t && ./smoke.t
update_samsung_dns_filter:
bash /usr/local/pf/addons/update-samsung-dns-filter.sh