|
Message-ID: <20110809113045.GA12614@albatros> Date: Tue, 9 Aug 2011 15:30:47 +0400 From: Vasiliy Kulikov <segoon@...nwall.com> To: musl@...ts.openwall.com Subject: cluts makefiles Hi, This is a patch to enhance musl building things. 1) Divided a single Makefile to the cluts, tests/, compile flags. 2) Used gcc's ability to identify dependencies. Unrelated things: include "sequence.c" is weird :) It's better to use .h with declarations and .c files which build into .o. With glibc: a) _SVID_SOURCE is needed for alphasort. b) SA_NODEFER is undefined in all .c. diff --git a/Makefile b/Makefile index 07377a8..e77ca3a 100644 --- a/Makefile +++ b/Makefile @@ -7,18 +7,27 @@ # There's ABSOLUTELY NO WARRANTY, express or implied. # -CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -O2 -LIBS = -lpthread -lrt -lm -SRC = $(wildcard tests/*.c) $(wildcard *.c) -BIN = $(SRC:.c=) +include defines.mk -%:%.c +SRC = cluts.c +BIN = cluts + +all: TESTS $(BIN) + @: + +%.o: %.c + $(CC) $(CFLAGS) $(LIBS) -c $< + +%: %.o $(CC) $(CFLAGS) $(LIBS) -o $@ $< -all: $(BIN) + +TESTS: + cd tests && make %.run:% ./$< test: all $(SRC:.c=.run) clean: - rm -f $(BIN) + rm -f $(BIN) *.o + cd tests && make clean diff --git a/defines.mk b/defines.mk new file mode 100644 index 0000000..220db82 --- /dev/null +++ b/defines.mk @@ -0,0 +1,2 @@ +CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -O2 +LIBS = -lpthread -lrt -lm diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..c6c3b5e --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,25 @@ +include ../include.mk + +SRC = $(wildcard *.c) +BIN = $(SRC:.c=) + +all: COMMON $(BIN) + @: +COMMON: + @: + +%.o: + $(CC) $(CFLAGS) $(LIBS) -c $< + +%: %.o + $(CC) $(CFLAGS) $(LIBS) -o $@ $< + +deps.mk: $(SRC) + $(CC) -MM $^ > $@ + +ifneq ($(MAKECMDGOALS),clean) +-include deps.mk +endif + +clean: + rm -rf $(BIN) *.o ---
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.