From 56b49c7258f6c597da56ac615c7387b655485c47 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 28 Aug 2016 00:47:28 -0400 Subject: generate static lib --- .gitignore | 3 ++- Makefile | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6785f9e..0ac942d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /*.o +/*.a /fhp-test -/libfhp.so +/*.so diff --git a/Makefile b/Makefile index 7878027..c76e497 100644 --- a/Makefile +++ b/Makefile @@ -3,22 +3,26 @@ CFLAGS=-std=c99 -W -Wall -pedantic -O2 -Iinclude -fPIC OBJS=fhp.o hash.o error.o token.o env.o te-parser.o SONAME=libfhp.so LIB=libfhp.so +STATIC_LIB=libfhp.a TEST_OBJS=test.o TEST_APP=./fhp-test TEST_LDFLAGS=-lfhp -L. -all: $(LIB) +all: $(LIB) $(STATIC_LIB) test: $(TEST_APP) LD_LIBRARY_PATH=. $(TEST_APP) clean: - rm -f $(LIB) $(OBJS) $(TEST_APP) $(TEST_OBJS) + rm -f $(LIB) $(STATIC_LIB) $(OBJS) $(TEST_APP) $(TEST_OBJS) $(LIB): $(OBJS) $(CC) -o $(LIB) -shared -Wl,-soname,$(SONAME) $(OBJS) +$(STATIC_LIB): $(OBJS) + ar r $(STATIC_LIB) $(OBJS) + $(TEST_APP): $(LIB) $(TEST_OBJS) $(CC) -o $(TEST_APP) $(TEST_OBJS) $(TEST_LDFLAGS) -- cgit v1.2.3