toml/Makefile

41 lines
676 B
Makefile
Raw Normal View History

2017-03-18 21:20:51 +00:00
CC = gcc
CFILES = toml.c
2019-05-02 13:33:15 +00:00
CFLAGS = -std=c99 -Wall -Wextra -fpic
2019-02-19 23:52:01 +00:00
# to compile for debug: make DEBUG=1
# to compile for no debug: make
ifdef DEBUG
CFLAGS += -O0 -g
else
CFLAGS += -O2 -DNDEBUG
endif
2017-03-18 21:20:51 +00:00
EXEC = toml_json toml_cat
2017-03-18 21:20:51 +00:00
LIB = libtoml.a
2019-05-02 13:33:15 +00:00
LIB_SHARED = libtoml.so
2017-03-18 21:20:51 +00:00
2019-05-02 13:33:15 +00:00
all: $(LIB) $(LIB_SHARED) $(EXEC)
2017-03-18 21:20:51 +00:00
libtoml.a: toml.o
ar -rcs $@ $^
2019-05-02 13:33:15 +00:00
libtoml.so: toml.o
$(CC) -shared -o $@ $^
2017-03-18 21:20:51 +00:00
toml_json: toml_json.c $(LIB)
toml_cat: toml_cat.c $(LIB)
2017-03-18 21:20:51 +00:00
prefix ?= /usr/local
install: all
install -d ${prefix}/include ${prefix}/lib
install toml.h ${prefix}/include
2019-05-02 13:33:15 +00:00
install $(LIB) ${prefix}/lib
install $(LIB_SHARED) ${prefix}/lib
2017-03-18 21:20:51 +00:00
clean:
2019-05-02 13:33:15 +00:00
rm -f *.o $(EXEC) $(LIB) $(LIB_SHARED)