File: Makefile

package info (click to toggle)
nginx-confgen 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: ansic: 867; makefile: 61
file content (78 lines) | stat: -rw-r--r-- 2,142 bytes parent folder | download
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
# SPDX-FileCopyrightText: Yorhel <projects@yorhel.nl>
# SPDX-License-Identifier: MIT

CC     ?= cc
CFLAGS ?= -Wall -O2 -g
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/share/man/man1

NGCFG_VERSION=2.2

.PHONY: all bin\
	test test-valgrind lint\
	dist distcheck\
	clean distclean\
	install install-bin install-doc\
	uninstall uninstall-bin uninstall-doc

all: bin
bin: nginx-confgen

nginx-confgen: nginx-confgen.c Makefile
	${CC} ${CFLAGS} -DNGCFG_VERSION='"${NGCFG_VERSION}"' $< -o $@

test: bin
	cd test && e=0 && for i in *.conf; do\
			f=`basename $$i .conf`;\
			../nginx-confgen -I inc -i $$i >$$f.out 2>&1;\
			[ ! -f $$f.test ] && cp $$f.out $$f.test;\
			d="`diff -u $$f.test $$f.out`";\
			if [ -n "$$d" ]; then echo; echo "$$d"; echo; e=1; fi;\
		done; exit $$e

test-valgrind: bin
	cd test && for i in *.conf; do\
			valgrind -q --error-exitcode=2 --log-file=valgrindlog -- ../nginx-confgen -I inc -i $$i >/dev/null 2>&1;\
			if [ $$? = 2 ]; then echo; echo "FAIL at $$i"; echo; cat valgrindlog; exit 1; fi; done
	rm -f test/valgrindlog

lint:
	reuse lint
	mandoc -Tlint nginx-confgen.1

dist:
	rm -f nginx-confgen-${NGCFG_VERSION}.tar.gz
	mkdir nginx-confgen-${NGCFG_VERSION}
	for f in `git ls-files | grep -v ^\.gitignore`; do mkdir -p nginx-confgen-${NGCFG_VERSION}/`dirname $$f`; ln -s "`pwd`/$$f" nginx-confgen-${NGCFG_VERSION}/$$f; done
	tar -cophzf nginx-confgen-${NGCFG_VERSION}.tar.gz --sort=name nginx-confgen-${NGCFG_VERSION}
	rm -rf nginx-confgen-${NGCFG_VERSION}

distcheck: dist
	tar -xzf nginx-confgen-${NGCFG_VERSION}.tar.gz
	${MAKE}  -C nginx-confgen-${NGCFG_VERSION} test
	rm -rf nginx-confgen-${NGCFG_VERSION}

clean:
	rm -f nginx-confgen test/*.test

distclean: clean

install: install-bin install-doc

install-bin: bin
	mkdir -p ${BINDIR}
	install -m0755 nginx-confgen ${BINDIR}/

install-doc:
	mkdir -p ${MANDIR}
	install -m0644 nginx-confgen.1 ${MANDIR}/

uninstall: uninstall-bin uninstall-doc

# XXX: Ideally, these would also remove the directories created by 'install' if they are empty.
uninstall-bin:
	rm -f ${BINDIR}/nginx-confgen

uninstall-doc:
	rm -f ${MANDIR}/nginx-confgen.1