diff options
author | Paul Duncan <pabs@pablotron.org> | 2023-09-16 09:58:39 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2023-09-16 09:58:39 -0400 |
commit | 75518adaa228ab1020637b889c01c1c6411d0d64 (patch) | |
tree | c825948baa0e542933cd30610ac7b81542c3204f /Makefile | |
parent | 6c8325139a08edf53c7097e9345d41b605a19373 (diff) | |
download | sha3-75518adaa228ab1020637b889c01c1c6411d0d64.tar.bz2 sha3-75518adaa228ab1020637b889c01c1c6411d0d64.zip |
Makefile: add shared library target
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,22 +1,30 @@ # compiler flags used for sample application and shared library -CFLAGS=-W -Wall -Wextra -Werror -pedantic -std=c11 -O3 -march=native -mtune=native +CFLAGS=-W -Wall -Wextra -Werror -pedantic -std=c11 -fPIC -O3 -march=native -mtune=native # sample application APP=./sha3 APP_OBJS=sha3.o main.o +# shared library +LIB=libsha3.so +LIB_OBJS=sha3.o + # test app (test suite and sanitizers) TEST_CFLAGS=-g -fsanitize=address,pointer-compare,pointer-subtract,undefined,leak -W -Wall -Wextra -Werror -pedantic -std=c11 TEST_APP=./test-sha3 .PHONY=test all -all: $(APP) +all: $(APP) $(LIB) # build sample application $(APP): $(APP_OBJS) $(CC) -o $(APP) $(CFLAGS) $(APP_OBJS) +# build shared library +$(LIB): $(LIB_OBJS) + $(CC) -shared -o $(LIB) $(CFLAGS) $(LIB_OBJS) + %.o: %.c $(CC) -c $(CFLAGS) $< @@ -25,4 +33,4 @@ test: $(CC) -o $(TEST_APP) $(TEST_CFLAGS) -DSHA3_TEST sha3.c && $(TEST_APP) clean: - $(RM) -f $(TEST_APP) $(APP) $(APP_OBJS) + $(RM) -f $(TEST_APP) $(APP) $(LIB_OBJS) $(APP_OBJS) |