From 40a6b355d56bbb1bfd66cca574b5e9c25e902fc4 Mon Sep 17 00:00:00 2001 From: Pau Freixes Date: Fri, 8 May 2020 23:06:23 +0200 Subject: [PATCH 1/4] Add command for build a static library --- makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index ec2974f..530df73 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ CFLAGS = -O3 -Wall -.PHONY: all clean tests +.PHONY: all clean tests static all: example example: example.o murmur3.o @@ -12,5 +12,9 @@ shared: murmur3.c murmur3.h $(CC) -fPIC -O3 -c murmur3.c $(CC) -shared -Wl,--export-dynamic murmur3.o -o libmurmur3.so +static: murmur3.c murmur3.h + $(CC) -fPIC -O3 -c murmur3.c + $(AR) rcs libmurmur3.a murmur3.o + clean: - rm -rf example *.o *.so + rm -rf example *.o *.so *.a From f7bb622b9280d13bfb815e00c450e4b5ec2c05ef Mon Sep 17 00:00:00 2001 From: Pau Freixes Date: Sun, 10 May 2020 15:54:10 +0200 Subject: [PATCH 2/4] Ignore static library --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 52bc176..6fbf70f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ example.o murmur3.o test.o tests +libmurmur3.a From 187d9b84113d0ffe70934a43573beeea22109b05 Mon Sep 17 00:00:00 2001 From: Haze Lee Date: Sun, 31 Jul 2022 21:03:44 +0900 Subject: [PATCH 3/4] chore: add cross-target build for macOS --- makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/makefile b/makefile index 530df73..fe4d046 100644 --- a/makefile +++ b/makefile @@ -16,5 +16,11 @@ static: murmur3.c murmur3.h $(CC) -fPIC -O3 -c murmur3.c $(AR) rcs libmurmur3.a murmur3.o +# Create macOS Architecture Specific Binary +# It can be arm64-apple-macos11 or x86_64-apple-macos10.12 +static_macos: murmur3.c murmur3.h + $(CC) -fPIC -O3 -c murmur3.c -target $(TARGET) -o murmur3.o + $(AR) rcs libmurmur3.a murmur3.o + clean: rm -rf example *.o *.so *.a From fe767ddff386f222531c5a5a9a92ad1e519f160f Mon Sep 17 00:00:00 2001 From: Haze Lee Date: Sun, 31 Jul 2022 22:27:07 +0900 Subject: [PATCH 4/4] fix: build universal static library for macos --- .gitignore | 4 ++-- makefile | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6fbf70f..0b12bee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ example example.o -murmur3.o +murmur3*.o test.o tests -libmurmur3.a +libmurmur3*.a diff --git a/makefile b/makefile index fe4d046..04d67d6 100644 --- a/makefile +++ b/makefile @@ -16,11 +16,13 @@ static: murmur3.c murmur3.h $(CC) -fPIC -O3 -c murmur3.c $(AR) rcs libmurmur3.a murmur3.o -# Create macOS Architecture Specific Binary -# It can be arm64-apple-macos11 or x86_64-apple-macos10.12 +# Create macOS Architecture Specific Binaries static_macos: murmur3.c murmur3.h - $(CC) -fPIC -O3 -c murmur3.c -target $(TARGET) -o murmur3.o - $(AR) rcs libmurmur3.a murmur3.o - + $(CC) -fPIC -O3 -c murmur3.c -target x86_64-apple-macos10.12 -o murmur3-x86_64.o + $(CC) -fPIC -O3 -c murmur3.c -target arm64-apple-macos11 -o murmur3-arm64.o + $(AR) rcs libmurmur3-x86_64.a murmur3-x86_64.o + $(AR) rcs libmurmur3-arm64.a murmur3-arm64.o + lipo -create -output libmurmur3.a libmurmur3-x86_64.a libmurmur3-arm64.a + clean: rm -rf example *.o *.so *.a