]> ruderich.org/simon Gitweb - nsscash/nsscash.git/commitdiff
nss: Makefile: build libcash_test.so in tests/
authorSimon Ruderich <simon@ruderich.org>
Mon, 10 Jun 2019 21:53:49 +0000 (23:53 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 10 Jun 2019 21:53:49 +0000 (23:53 +0200)
Prevents accidentally copying the test library instead of the actual NSS
library.

.gitignore
nss/Makefile

index 263abf9bad3681d5552bce755814a0b4f5daf01a..c350eb7bbd4b54107f9c402168ee8ff8ce69de15 100644 (file)
@@ -1,8 +1,8 @@
 /filetype_string.go
-/nss/libcash_test.so
 /nss/libnss_cash.so.2
 /nss/tests/gr
 /nss/tests/group.nsscash
+/nss/tests/libcash_test.so
 /nss/tests/passwd.nsscash
 /nss/tests/pw
 /nsscash
index bbc43ee4f35c4c57e3da632b26ea323af0f5daa3..7dfe54738cf998245b2ca8ab5c61769e715dacff 100644 (file)
@@ -13,10 +13,10 @@ all: libnss_cash.so.2
 
 clean:
        rm -f libnss_cash.so.2 \
-           libcash_test.so tests/gr tests/pw \
+           tests/libcash_test.so tests/gr tests/pw \
            tests/group.nsscash tests/passwd.nsscash
 
-libnss_cash.so.2 libcash_test.so: $(wildcard *.c) $(wildcard *.h)
+libnss_cash.so.2 tests/libcash_test.so: $(wildcard *.c) $(wildcard *.h)
        $(CC) -o $@ -shared -fPIC -Wl,-soname,$@ \
                $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
                file.c gr.c pw.c search.c \
@@ -26,12 +26,12 @@ libnss_cash.so.2 libcash_test.so: $(wildcard *.c) $(wildcard *.h)
 # Tests
 
 test: tests/gr tests/pw tests/group.nsscash tests/passwd.nsscash
-       LD_LIBRARY_PATH=. LD_PRELOAD= ./tests/gr
-       LD_LIBRARY_PATH=. LD_PRELOAD= ./tests/pw
+       LD_LIBRARY_PATH=./tests LD_PRELOAD= ./tests/gr
+       LD_LIBRARY_PATH=./tests LD_PRELOAD= ./tests/pw
 
-tests/%: tests/%.c libcash_test.so
+tests/%: tests/%.c tests/libcash_test.so
        $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
-               $(TEST_CFLAGS) $(TEST_LDFLAGS) -L. \
+               $(TEST_CFLAGS) $(TEST_LDFLAGS) -Ltests \
                $< $(LDLIBS) -lcash_test -lasan
 
 tests/passwd.nsscash: tests/passwd
@@ -39,9 +39,9 @@ tests/passwd.nsscash: tests/passwd
 tests/group.nsscash: tests/group
        ../nsscash convert group $< $@
 
-libcash_test.so: CFLAGS += $(TEST_CFLAGS)
-libcash_test.so: CPPFLAGS += -DNSSCASH_GROUP_FILE='"./tests/group.nsscash"' \
-                             -DNSSCASH_PASSWD_FILE='"./tests/passwd.nsscash"'
-libcash_test.so: LDFLAGS += $(TEST_LDFLAGS)
+tests/libcash_test.so: CFLAGS += $(TEST_CFLAGS)
+tests/libcash_test.so: CPPFLAGS += -DNSSCASH_GROUP_FILE='"./tests/group.nsscash"' \
+                                   -DNSSCASH_PASSWD_FILE='"./tests/passwd.nsscash"'
+tests/libcash_test.so: LDFLAGS += $(TEST_LDFLAGS)
 
 .PHONY: all clean test