From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/365 Path: news.gmane.org!not-for-mail From: Vasiliy Kulikov Newsgroups: gmane.linux.lib.musl.general Subject: cluts makefiles Date: Tue, 9 Aug 2011 15:30:47 +0400 Message-ID: <20110809113045.GA12614@albatros> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1312889526 23726 80.91.229.12 (9 Aug 2011 11:32:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2011 11:32:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-366-gllmg-musl=m.gmane.org@lists.openwall.com Tue Aug 09 13:32:01 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QqkXQ-000095-Va for gllmg-musl@lo.gmane.org; Tue, 09 Aug 2011 13:32:01 +0200 Original-Received: (qmail 17471 invoked by uid 550); 9 Aug 2011 11:31:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 17459 invoked from network); 9 Aug 2011 11:31:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=5SOr/2xxPhQJ3P9HsQfcejP0gQ9NUq2nP/vsw1PJEpE=; b=nMjvvuclXOPgyYyJQu/f87a1AI5oGgX9L4bN1E5ACPBkR9IZgenNwomGNaBNjPb6J1 o8Fw0g+n/piOAac2GbJ7AuF9L8cf8bA4WFeiti8DO2vQZTiU6ZGnP+Koc4D+1iV4DO9M nFAIfNZCZ/ATCqfB+KYIp2x1NpP4/EUNqFQjw= Original-Sender: Vasiliy Kulikov Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Xref: news.gmane.org gmane.linux.lib.musl.general:365 Archived-At: 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 ---