2020-06-13 23:18:57 +00:00
|
|
|
HFILES = toml.h
|
2017-03-18 21:20:51 +00:00
|
|
|
CFILES = toml.c
|
2021-01-10 01:19:09 +00:00
|
|
|
OBJ = $(CFILES:.c=.o)
|
2020-11-02 02:31:50 +00:00
|
|
|
EXEC = toml_json toml_cat toml_sample
|
2021-12-11 01:01:52 +00:00
|
|
|
PCFILE = libtoml.pc
|
2017-03-18 21:20:51 +00:00
|
|
|
|
2019-05-02 13:33:15 +00:00
|
|
|
CFLAGS = -std=c99 -Wall -Wextra -fpic
|
2021-02-16 11:45:18 +00:00
|
|
|
LIB_VERSION = 1.0
|
2020-06-13 23:18:57 +00:00
|
|
|
LIB = libtoml.a
|
2021-02-16 11:45:18 +00:00
|
|
|
LIB_SHARED = libtoml.so.$(LIB_VERSION)
|
2020-06-13 23:18:57 +00:00
|
|
|
|
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 $@ $^
|
|
|
|
|
2021-02-16 11:45:18 +00:00
|
|
|
libtoml.so.$(LIB_VERSION): toml.o
|
2019-05-02 13:33:15 +00:00
|
|
|
$(CC) -shared -o $@ $^
|
|
|
|
|
2017-03-18 21:20:51 +00:00
|
|
|
toml_json: toml_json.c $(LIB)
|
|
|
|
|
2017-08-07 21:47:59 +00:00
|
|
|
toml_cat: toml_cat.c $(LIB)
|
|
|
|
|
2020-11-02 02:31:50 +00:00
|
|
|
toml_sample: toml_sample.c $(LIB)
|
|
|
|
|
2020-11-02 01:52:57 +00:00
|
|
|
|
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
|
2021-12-11 01:01:52 +00:00
|
|
|
install $(PCFILE) /usr/lib/pkgconfig
|
2017-03-18 21:20:51 +00:00
|
|
|
|
|
|
|
clean:
|
2019-05-02 13:33:15 +00:00
|
|
|
rm -f *.o $(EXEC) $(LIB) $(LIB_SHARED)
|
2021-01-10 01:19:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean install
|