Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command for build a static library #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
example
example.o
murmur3.o
murmur3*.o
test.o
tests
libmurmur3*.a
16 changes: 14 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS = -O3 -Wall

.PHONY: all clean tests
.PHONY: all clean tests static

all: example
example: example.o murmur3.o
Expand All @@ -12,5 +12,17 @@ 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

# Create macOS Architecture Specific Binaries
static_macos: murmur3.c murmur3.h
$(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
rm -rf example *.o *.so *.a