forked from inverse-inc/packetfence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
131 lines (96 loc) · 3.81 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
all:
@echo "Please chose which documentation to build:"
@echo ""
@echo " 'pdf' will build all guides using the PDF format"
@echo " 'PacketFence_Administration_Guide.pdf' will build the Administration guide in PDF"
@echo " 'PacketFence_Developers_Guide.pdf' will build the Develoeprs guide in PDF"
@echo " 'PacketFence_Network_Devices_Configuration_Guide.pdf' will build the Network Devices Configuration guide in PDF"
pdf: $(patsubst %.asciidoc,%.pdf,$(notdir $(wildcard docs/PacketFence_*.asciidoc)))
%.pdf : docs/%.asciidoc
asciidoc \
-a docinfo2 \
-b docbook \
-d book \
-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 docs/$@
html: $(patsubst %.asciidoc,%.html,$(notdir $(wildcard docs/PacketFence_*.asciidoc)))
%.html : docs/%.asciidoc
asciidoctor \
-D docs/html \
-n \
$<
html/pfappserver/root/static/doc:
make html
mkdir -p docs/html/docs/images/
cp -a docs/images/* docs/html/docs/images/
mv docs/html html/pfappserver/root/static/doc
pfcmd.help:
/usr/local/pf/bin/pfcmd help > docs/pfcmd.help
.PHONY: configurations
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
# 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/pf_omapi_key:
/usr/bin/openssl rand -base64 -out /usr/local/pf/conf/pf_omapi_key 32
conf/local_secret:
date +%s | sha256sum | base64 | head -c 32 > /usr/local/pf/conf/local_secret
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.sudoers
.PHONY:sudo
sudo:/etc/sudoers.d/packetfence.sudoers
permissions:
./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;\
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;
ln -f -s /usr/local/pf/db/pf_graphite-schema-5.1.0.sql /usr/local/pf/db/pf_graphite-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: pf-dal
pf-dal:
perl /usr/local/pf/addons/dev-helpers/bin/generator-data-access-layer.pl
devel: configurations conf/ssl/server.crt conf/pf_omapi_key conf/local_secret bin/pfcmd raddb/certs/server.crt sudo translation mysql-schema raddb/sites-enabled fingerbank chown_pf permissions bin/ntlm_auth_wrapper html/pfappserver/root/static/doc