From bf7f1f86b0bae79a57b365fdf5ba9281dbbc5e0c Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Sun, 9 Dec 2018 10:19:16 +0000 Subject: [PATCH] change makefile to use musl 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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2541ac6..33380f5 100644 --- 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 -- 2.40.0