tomlc99_rtt_pkg/Makefile

40 lines
666 B
Makefile
Raw Permalink Normal View History

2017-03-19 05:20:51 +08:00
CFILES = toml.c
2019-05-02 21:33:15 +08:00
CFLAGS = -std=c99 -Wall -Wextra -fpic
2019-02-20 07:52:01 +08: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-19 05:20:51 +08:00
EXEC = toml_json toml_cat
2017-03-19 05:20:51 +08:00
LIB = libtoml.a
2019-05-02 21:33:15 +08:00
LIB_SHARED = libtoml.so
2017-03-19 05:20:51 +08:00
2019-05-02 21:33:15 +08:00
all: $(LIB) $(LIB_SHARED) $(EXEC)
2017-03-19 05:20:51 +08:00
libtoml.a: toml.o
ar -rcs $@ $^
2019-05-02 21:33:15 +08:00
libtoml.so: toml.o
$(CC) -shared -o $@ $^
2017-03-19 05:20:51 +08:00
toml_json: toml_json.c $(LIB)
toml_cat: toml_cat.c $(LIB)
2017-03-19 05:20:51 +08:00
prefix ?= /usr/local
install: all
install -d ${prefix}/include ${prefix}/lib
install toml.h ${prefix}/include
2019-05-02 21:33:15 +08:00
install $(LIB) ${prefix}/lib
install $(LIB_SHARED) ${prefix}/lib
2017-03-19 05:20:51 +08:00
clean:
2019-05-02 21:33:15 +08:00
rm -f *.o $(EXEC) $(LIB) $(LIB_SHARED)