diff options
Diffstat (limited to 'nss/Makefile')
-rw-r--r-- | nss/Makefile | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/nss/Makefile b/nss/Makefile new file mode 100644 index 0000000..c4ff2ea --- /dev/null +++ b/nss/Makefile @@ -0,0 +1,73 @@ + +WARNFLAGS = \ + -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \ + -Wcast-align -Wwrite-strings -Wsign-compare \ + -Wmissing-noreturn \ + -Wextra -Wstrict-aliasing=2 \ + -Wunsafe-loop-optimizations \ + -Wuninitialized + +# Compiler flags for generating dependencies +DEPFLAGS = -MMD -MP +CFLAGS ?= -O3 +# CFLAGS ?= -O0 -g +# LDFLAGS ?= -g +ALLCFLAGS = -std=gnu99 -fPIC $(WARNFLAGS) $(DEPFLAGS) $(CFLAGS) + +# declarations + +RAINBOW_OBJS = nss-rainbow.o buf.o nat.o slist.o +UIDS_OBJS = uids.o +GIDS_OBJS = gids.o +TEST_SLIST_OBJS = test_slist.o slist.o +TEST_ENDGRENT_OBJS = test_endgrent.o +TEST_NAT_OBJS = test_nat.o nat.o +TEST_FORMAT_BUF_OBJS = test_format_buf.o buf.o +ALL_OBJS = $(RAINBOW_OBJS) $(UIDS_OBJS) $(GIDS_OBJS) $(TEST_SLIST_OBJS) $(TEST_NAT_OBJS) +BINARIES = libnss_rainbow.so.2 uids gids test_slist test_nat test_endgrent test_format_buf + +# targets + +all: $(BINARIES) + +clean: + rm -f $(BINARIES) *.d *.o + +install: + install -D -m 0755 libnss_rainbow.so.2 $(LIBDIR)/libnss_rainbow.so.2 + +# objects + +%.o: %.c + $(CC) $(ALLCFLAGS) -c -o $@ $< + + +# linked binaries + +test_endgrent: $(TEST_ENDGRENT_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +test_slist: $(TEST_SLIST_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +test_nat: $(TEST_NAT_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +test_format_buf: $(TEST_FORMAT_BUF_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +uids: $(UIDS_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +gids: $(GIDS_OBJS) + $(CC) $(ALLCFLAGS) -o $@ $^ + +libnss_rainbow.so.2: $(RAINBOW_OBJS) + $(CC) -shared $(LDFLAGS) -o $@ -Wl,-soname,$@ $^ + + +.PHONY: clean install + +-include $(ALL_OBJS:%.o=%.d) + +# vim: noet sts=4 ts=4 sw=4 : |