]> pd.if.org Git - zpackage/commitdiff
change makefile to use musl
authorNathan Wagner <nw@hydaspes.if.org>
Sun, 9 Dec 2018 10:19:16 +0000 (10:19 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sun, 9 Dec 2018 10:22:39 +0000 (10:22 +0000)
Glibc can't compile truly static executables because it always wants to
dynamically load name service handlers.  musl doesn't have this problem,
so we compile against musl with clang, which now has a musl target.

Makefile

index 2541ac6f1b0b7fc980cb904f6d6a13f1e5d8b799..33380f54cf81ad420c278f5276530a34305ca05d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
-CC=clang
+CC=clang --target=x86_64-pc-linux-musl
 #CC=/usr/musl/bin/musl-gcc
-CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api
+CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api --target=x86_64-pc-linux-musl
 
 ZPMVER:=$(shell git describe --tags --match 'v[0-9]*' | sed -e 's/^v//' | sed -e 's/-g.\+//' | sed -e 's/-/./g')
 
 LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4
 
-LDFLAGS=-L. -static
+LDFLAGS=-fuse-ld=lld -L. -static
 
 LZMACHECKSRC=lzma/check/check.c lzma/check/crc32_fast.c lzma/check/crc64_fast.c lzma/check/crc32_table.c lzma/check/crc64_table.c
 LZMASRC=$(shell ls lzma/lzma/*.c lzma/common/*.c lzma/lz/*.c) $(LZMACHECKSRC) lzma/rangecoder/price_table.c
@@ -96,7 +96,7 @@ stest: $(ZPKGBIN)
        PATH=$(curdir)/t:$(curdir):$(PATH) t/$(T).t
 
 t/ctap/prove: t/ctap/prove.o
-       $(CC) $(CFLAGS) -o $@ $+
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
 
 test: $(ZPKGBIN) t/ctap/prove
        @PATH=$(curdir)/t:$(curdir):$(PATH) t/ctap/prove t/*.t
@@ -206,5 +206,7 @@ clean:
        rm -f *.o sqlite/*.o lib/*.o $(LZMAOBJ) liblzma.a \
                libelf.a libzpm.a zpm-addfile soname \
                *.xz \
-               local.db t/ctap/prove.o $(ZPKGBIN) \
+               local.db 
+               t/ctap/*.o \
+               $(ZPKGBIN) \
                db.sql