3 CFLAGS = -Wall -Wextra -Wconversion
4 # DEB_BUILD_MAINT_OPTIONS='hardening=+all qa=+bug' dpkg-buildflags --export=make
5 CFLAGS += -g -O2 -Werror=array-bounds -Werror=clobbered -Werror=volatile-register-var -Werror=implicit-function-declaration -fstack-protector-strong -Wformat -Werror=format-security
6 CPPFLAGS += -Wdate-time -D_FORTIFY_SOURCE=2
7 LDFLAGS += -Wl,-z,relro -Wl,-z,now
9 TEST_CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
10 TEST_LDFLAGS += -fsanitize=address -fsanitize=undefined
15 rm -f libnss_cash.so.2 \
16 libcash_test.so tests/pw tests/passwd.nsscash
18 libnss_cash.so.2 libcash_test.so: $(wildcard *.c) $(wildcard *.h)
19 $(CC) -o $@ -shared -fPIC -Wl,-soname,$@ \
20 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
21 file.c pw.c search.c \
27 test: tests/pw tests/passwd.nsscash
28 LD_LIBRARY_PATH=. LD_PRELOD= ./tests/pw
30 tests/pw: tests/pw.c libcash_test.so
31 $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
32 $(TEST_CFLAGS) $(TEST_LDFLAGS) -L. \
33 $< $(LDLIBS) -lcash_test -lasan
35 tests/passwd.nsscash: tests/passwd
36 ../nsscash convert passwd $< $@
38 libcash_test.so: CFLAGS += $(TEST_CFLAGS)
39 libcash_test.so: CPPFLAGS += -DNSSCASH_PASSWD_FILE='"./tests/passwd.nsscash"'
40 libcash_test.so: LDFLAGS += $(TEST_LDFLAGS)
42 .PHONY: all clean test