From 7937e862554ae4cc8722dbf66f53c3da2259e0c5 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Apr 2019 21:18:11 +0000 Subject: test-amalgamation: fix the list of prerequisites Add $(LZ4DIR)/lz4frame.c to the list of prerequisites as the rule uses that file. Fixes: b192c86b ("[amalgamation] lz4frame.c") --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 67514e4..bcaf603 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -157,7 +157,7 @@ test32: CFLAGS+=-m32 test32: test .PHONY: test-amalgamation -test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c +test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c cat $(LZ4DIR)/lz4.c > lz4_all.c cat $(LZ4DIR)/lz4hc.c >> lz4_all.c cat $(LZ4DIR)/lz4frame.c >> lz4_all.c -- cgit v0.12 From 10726d4c56a54393ff105009077124472f0a369c Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Apr 2019 21:18:11 +0000 Subject: test-amalgamation: use a single cat command Use the list of prerequisites instead of listing those files manually, this way they will never fall out of sync. Also update the amalgamation example to use a single cat command. Fixes: a7e8d394 ("[amalgamation] add test") Fixes: b192c86b ("[amalgamation] lz4frame.c") --- lib/README.md | 4 +--- tests/Makefile | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/README.md b/lib/README.md index b753195..cf1505f 100644 --- a/lib/README.md +++ b/lib/README.md @@ -74,9 +74,7 @@ The following build macro can be selected at compilation time : lz4 source code can be amalgamated into a single file. One can combine all source code into `lz4_all.c` by using following command: ``` -cat lz4.c > lz4_all.c -cat lz4hc.c >> lz4_all.c -cat lz4frame.c >> lz4_all.c +cat lz4.c lz4hc.c lz4frame.c > lz4_all.c ``` (`cat` file order is important) then compile `lz4_all.c`. All `*.h` files present in `/lib` remain necessary to compile `lz4_all.c`. diff --git a/tests/Makefile b/tests/Makefile index bcaf603..f327535 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -158,9 +158,7 @@ test32: test .PHONY: test-amalgamation test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c - cat $(LZ4DIR)/lz4.c > lz4_all.c - cat $(LZ4DIR)/lz4hc.c >> lz4_all.c - cat $(LZ4DIR)/lz4frame.c >> lz4_all.c + cat $^ > lz4_all.c $(CC) -I$(LZ4DIR) -c lz4_all.c $(RM) lz4_all.c -- cgit v0.12 From 8069d2ae6ff88fbaeff1c8d5bf1e4d3eedca1d3c Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Apr 2019 21:18:11 +0000 Subject: test-amalgamation: fix compilation options Use the same compilation options to compile lz4_all.c and other object files. Fixes: a7e8d394 ("[amalgamation] add test") --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index f327535..36cb26a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -159,7 +159,7 @@ test32: test .PHONY: test-amalgamation test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c cat $^ > lz4_all.c - $(CC) -I$(LZ4DIR) -c lz4_all.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c lz4_all.c $(RM) lz4_all.c test-install: lz4 lib liblz4.pc -- cgit v0.12 From 0d3f85df651cf298e0a60c646e119e3e5fd90c72 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Apr 2019 21:18:11 +0000 Subject: test-amalgamation: split the rule Change test-amalgamation to follow each-rule-makes-a-single-target idiom. Fixes: a7e8d394 ("[amalgamation] add test") --- tests/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 36cb26a..8f0dfd3 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -114,7 +114,7 @@ clean: frametest$(EXT) frametest32$(EXT) \ fasttest$(EXT) roundTripTest$(EXT) \ datagen$(EXT) checkTag$(EXT) \ - frameTest$(EXT) + frameTest$(EXT) lz4_all.c @$(RM) -rf $(TESTDIR) @echo Cleaning completed @@ -156,11 +156,13 @@ test: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer test-install test32: CFLAGS+=-m32 test32: test -.PHONY: test-amalgamation -test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c - cat $^ > lz4_all.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c lz4_all.c - $(RM) lz4_all.c +test-amalgamation: lz4_all.o + +lz4_all.o: lz4_all.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@ + +lz4_all.c: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c + cat $^ > $@ test-install: lz4 lib liblz4.pc lz4_root=.. ./test_install.sh -- cgit v0.12