toml/Makefile

43 lines
720 B
Makefile
Raw Normal View History

2020-06-13 23:18:57 +00:00
HFILES = toml.h
2017-03-18 21:20:51 +00:00
CFILES = toml.c
2020-06-13 23:18:57 +00:00
OBJ = $(CFILES:.c=.o)
EXEC = toml_json toml_cat
2017-03-18 21:20:51 +00:00
2019-05-02 13:33:15 +00:00
CFLAGS = -std=c99 -Wall -Wextra -fpic
2020-06-13 23:18:57 +00:00
LIB = libtoml.a
LIB_SHARED = libtoml.so
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
2019-05-02 13:33:15 +00:00
all: $(LIB) $(LIB_SHARED) $(EXEC)
2017-03-18 21:20:51 +00:00
2020-06-13 23:18:57 +00:00
*.o: $(HFILES)
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)