Makefile 2.36 KB
Newer Older
1 2 3
all:

mount:
4
	/sbin/mount_unionfs ${.CURDIR}/src /usr/local
5 6

umount:
7
	/sbin/umount -f "<above>:${.CURDIR}/src"
8 9

install:
10
	# hardcode package meta files to catch mishaps
11
	@cp ${.CURDIR}/pkg/+PRE_DEINSTALL ${DESTDIR}
12 13
	@cp ${.CURDIR}/pkg/+POST_INSTALL ${DESTDIR}
	@cp ${.CURDIR}/pkg/+MANIFEST ${DESTDIR}
14
	# move all sources to their destination
15
	@mkdir -p ${DESTDIR}/usr/local
16
	@cp -r ${.CURDIR}/src/* ${DESTDIR}/usr/local
17 18 19
	# disable warnings for production systems
	@sed -i '' -e 's/E_STRICT/E_STRICT | E_WARNING/g' \
	    ${DESTDIR}/usr/local/etc/rc.php_ini_setup
20 21 22 23 24 25
	# bootstrap pkg(8) files that are not in sources
	@mkdir -p ${DESTDIR}/usr/local/etc/pkg/repos
	@cp ${.CURDIR}/pkg/OPNsense.conf ${DESTDIR}/usr/local/etc/pkg/repos
	@echo /usr/local/etc/pkg/repos/OPNsense.conf
	@cp ${.CURDIR}/pkg/pkg.conf ${DESTDIR}/usr/local/etc
	@echo /usr/local/etc/pkg.conf
26 27 28 29
	@mkdir -p ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted
	@cp ${.CURDIR}/pkg/trusted/pkg.opnsense.org.20150402 \
	    ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted
	@echo /usr/local/etc/pkg/fingerprints/OPNsense/trusted/pkg.opnsense.org.20150402
30
	# finally pretty-print a list of files present
31 32
	@(cd ${.CURDIR}/src; find * -type f) | \
	    xargs -n1 printf "/usr/local/%s\n"
33 34

lint:
35 36 37
	find ${.CURDIR}/src ! -name "*.xml" ! -name "*.eot" \
	    ! -name "*.svg" ! -name "*.woff" ! -name "*.woff2" \
	    ! -name "*.otf" ! -name "*.png" ! -name "*.js" \
38
	    ! -name "*.scss" ! -name "*.py" ! -name "*.ttf" \
39
	    ! -name "*.tgz" -type f -print0 | xargs -0 -n1 php -l
40 41

sweep:
42
	find ${.CURDIR}/src ! -name "*.min.*" ! -name "*.svg" \
43 44
	    ! -name "*.map" -type f -print0 | \
	    xargs -0 -n1 scripts/cleanfile
45 46
	find ${.CURDIR}/pkg -type f -print0 | \
	    xargs -0 -n1 scripts/cleanfile
47

48
style:
49
	@(phpcs --tab-width=4 --standard=PSR2 ${.CURDIR}/src/opnsense/mvc \
50 51 52 53 54 55 56 57
	    || true) > ${.CURDIR}/.style.out
	@echo -n "Total number of style warnings: "
	@grep '| WARNING' ${.CURDIR}/.style.out | wc -l
	@echo -n "Total number of style errors:   "
	@grep '| ERROR' ${.CURDIR}/.style.out | wc -l
	@cat ${.CURDIR}/.style.out
	@rm ${.CURDIR}/.style.out

58
setup:
59
	${.CURDIR}/src/etc/rc.php_ini_setup
60

61 62 63 64
health:
	# check test script output and advertise a failure...
	[ "`${.CURDIR}/src/etc/rc.php_test_run`" == "FCGI-PASSED PASSED" ]

65 66 67
clean:
	git reset --hard HEAD && git clean -xdqf .

68
.PHONY: mount umount install lint sweep style setup health clean