Add rules for libtoml.so to Makefile

This commit is contained in:
Oliver Breitwieser 2019-05-02 15:33:15 +02:00
parent e93b40c3ea
commit 93cae7a0e6

View file

@ -1,7 +1,7 @@
CC = gcc CC = gcc
CFILES = toml.c CFILES = toml.c
CFLAGS = -std=c99 -Wall -Wextra CFLAGS = -std=c99 -Wall -Wextra -fpic
# to compile for debug: make DEBUG=1 # to compile for debug: make DEBUG=1
# to compile for no debug: make # to compile for no debug: make
ifdef DEBUG ifdef DEBUG
@ -13,13 +13,17 @@ endif
EXEC = toml_json toml_cat EXEC = toml_json toml_cat
LIB = libtoml.a LIB = libtoml.a
LIB_SHARED = libtoml.so
all: $(LIB) $(EXEC) all: $(LIB) $(LIB_SHARED) $(EXEC)
libtoml.a: toml.o libtoml.a: toml.o
ar -rcs $@ $^ ar -rcs $@ $^
libtoml.so: toml.o
$(CC) -shared -o $@ $^
toml_json: toml_json.c $(LIB) toml_json: toml_json.c $(LIB)
toml_cat: toml_cat.c $(LIB) toml_cat: toml_cat.c $(LIB)
@ -29,7 +33,8 @@ prefix ?= /usr/local
install: all install: all
install -d ${prefix}/include ${prefix}/lib install -d ${prefix}/include ${prefix}/lib
install toml.h ${prefix}/include install toml.h ${prefix}/include
install libtoml.a ${prefix}/lib install $(LIB) ${prefix}/lib
install $(LIB_SHARED) ${prefix}/lib
clean: clean:
rm -f *.o $(EXEC) $(LIB) rm -f *.o $(EXEC) $(LIB) $(LIB_SHARED)