From d177bb1fb75b129721219d9c40ff910840db9785 Mon Sep 17 00:00:00 2001 From: Benjamin Beasley Date: Tue, 20 Oct 2020 13:45:03 -0400 Subject: Move bundled zopfli sources into a new zopfli/ subdirectory. Separating source files by origin (and license) makes it easy for users who want to build with an external zopfli library to remove the bundled sources, ensuring they are not used. Unbundling libraries is mandatory for packaging in many popular Linux distributions, and can be useful for other applications as well. Additional changes will be needed to make it easy to select an external zopfli library. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cb2577a..2f644f2 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ -FILES=blocksplitter.c cache.c deflate.c gzip_container.c hash.c katajainen.c lz77.c squeeze.c tree.c util.c zlib_container.c zopfli_lib.c woff.c +FILES=zopfli/blocksplitter.c zopfli/cache.c zopfli/deflate.c zopfli/gzip_container.c zopfli/hash.c zopfli/katajainen.c zopfli/lz77.c zopfli/squeeze.c zopfli/tree.c zopfli/util.c zopfli/zlib_container.c zopfli/zopfli_lib.c woff.c all: sfnt2woff-zopfli woff2sfnt-zopfli sfnt2woff-zopfli: sfnt2woff.c $(FILES) Makefile - $(CC) $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm woff2sfnt-zopfli: woff2sfnt.c $(FILES) Makefile - $(CC) $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm clean: $(RM) -r *.o *.dSYM sfnt2woff-zopfli woff2sfnt-zopfli *.gch *.out -- cgit v1.2.3 From 3e6cf7a7b29698b69f96e848f84196aeda57b4a4 Mon Sep 17 00:00:00 2001 From: Benjamin Beasley Date: Tue, 20 Oct 2020 14:35:42 -0400 Subject: Add support for external CPPFLAGS/CFLAGS to the Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2f644f2..173394b 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ FILES=zopfli/blocksplitter.c zopfli/cache.c zopfli/deflate.c zopfli/gzip_contain all: sfnt2woff-zopfli woff2sfnt-zopfli sfnt2woff-zopfli: sfnt2woff.c $(FILES) Makefile - $(CC) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) $(CPPFLAGS) $(CFLAGS) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm woff2sfnt-zopfli: woff2sfnt.c $(FILES) Makefile - $(CC) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) $(CPPFLAGS) $(CFLAGS) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm clean: $(RM) -r *.o *.dSYM sfnt2woff-zopfli woff2sfnt-zopfli *.gch *.out -- cgit v1.2.3 From 6323a64c051817854a7c992e0259cc0e2bc5fb38 Mon Sep 17 00:00:00 2001 From: Benjamin Beasley Date: Tue, 20 Oct 2020 18:02:55 -0400 Subject: Add ZOPFLI_LIBS and ZOPFLI_CFLAGS variables to the Makefile to make it easy to build with an external Zopfli library. Set their default values such that the bundled Zopfli library is still used by default. Re-order the linker flags so that both cases work as expected. Fix linker flag order --- Makefile | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 173394b..c377015 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,35 @@ -FILES=zopfli/blocksplitter.c zopfli/cache.c zopfli/deflate.c zopfli/gzip_container.c zopfli/hash.c zopfli/katajainen.c zopfli/lz77.c zopfli/squeeze.c zopfli/tree.c zopfli/util.c zopfli/zlib_container.c zopfli/zopfli_lib.c woff.c +# When using the bundled Zopfli library, this is a list of sources to compile. +# To use an external Zopfli library, override it with the path to a static +# library, or with something like -lzopfli. +ZOPFLI_LIBS=zopfli/blocksplitter.c \ + zopfli/cache.c \ + zopfli/deflate.c \ + zopfli/gzip_container.c \ + zopfli/hash.c \ + zopfli/katajainen.c \ + zopfli/lz77.c \ + zopfli/squeeze.c \ + zopfli/tree.c \ + zopfli/util.c \ + zopfli/zlib_container.c \ + zopfli/zopfli_lib.c +# When not using the bundled Zopfli library, this should normally be overridden +# with the empty string to avoid finding bundled Zopfli headers. +ZOPFLI_CFLAGS=-Izopfli + +FILES=woff.c all: sfnt2woff-zopfli woff2sfnt-zopfli sfnt2woff-zopfli: sfnt2woff.c $(FILES) Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) \ + $(FILES) $< -o $@ \ + $(LDFLAGS) $(ZOPFLI_LIBS) -lz -lm woff2sfnt-zopfli: woff2sfnt.c $(FILES) Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) -Izopfli $(LDFLAGS) $(FILES) $< -o $@ -lz -lm + $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) \ + $(FILES) $< -o $@ \ + $(LDFLAGS) $(ZOPFLI_LIBS) -lz -lm clean: $(RM) -r *.o *.dSYM sfnt2woff-zopfli woff2sfnt-zopfli *.gch *.out -- cgit v1.2.3 From 6b63776f3d03f8b88d23cedb6fe2a9bd2947d93d Mon Sep 17 00:00:00 2001 From: Benjamin Beasley Date: Tue, 20 Oct 2020 18:05:40 -0400 Subject: Add ZLIB_LIBS and ZLIB_CFLAGS variables to the Makefile to make it easy to control linking against zlib, just as we added ZOPFLI_LIBS and ZOPFLI_CFLAGS for the Zopfli library. --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c377015..4fd80b1 100644 --- a/Makefile +++ b/Makefile @@ -17,19 +17,22 @@ ZOPFLI_LIBS=zopfli/blocksplitter.c \ # with the empty string to avoid finding bundled Zopfli headers. ZOPFLI_CFLAGS=-Izopfli +ZLIB_LIBS=-lz +ZLIB_CFLAGS= + FILES=woff.c all: sfnt2woff-zopfli woff2sfnt-zopfli sfnt2woff-zopfli: sfnt2woff.c $(FILES) Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) \ + $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) $(ZLIB_CFLAGS) \ $(FILES) $< -o $@ \ - $(LDFLAGS) $(ZOPFLI_LIBS) -lz -lm + $(LDFLAGS) $(ZOPFLI_LIBS) $(ZLIB_LIBS) -lm woff2sfnt-zopfli: woff2sfnt.c $(FILES) Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) \ + $(CC) $(CPPFLAGS) $(CFLAGS) $(ZOPFLI_CFLAGS) $(ZLIB_CFLAGS) \ $(FILES) $< -o $@ \ - $(LDFLAGS) $(ZOPFLI_LIBS) -lz -lm + $(LDFLAGS) $(ZOPFLI_LIBS) $(ZLIB_LIBS) -lm clean: $(RM) -r *.o *.dSYM sfnt2woff-zopfli woff2sfnt-zopfli *.gch *.out -- cgit v1.2.3