kmx.io/kv/Makefile

Branch

Thomas de Grivel d5556884c 2022-01-04T20:18:17
tests

all: build

build: libkv kv

LIBKV_SRC = \
	buffer.c \
	kv_chars.c \
	kv_parse.c \
	kv_path.c \
	kv_quote.c \
	rope.c

LIBKV_O = ${LIBKV_SRC:.c=.o}

KV_SRC = \
	kv.c

KV_O = kv.o libkv.a

CFLAGS ?=
CFLAGS += -W -Wall -Werror -std=c89 -pedantic -I.

ifeq ($(DEBUG),)
CFLAGS += -O2
else
CFLAGS += -DDEBUG -O0 -g3
endif

CLEANFILES =

libkv: libkv.a

libkv.a: ${LIBKV_O}
	ar -cru libkv.a ${LIBKV_O}
CLEANFILES += libkv.a

.c.o:
	${CC} ${CPPFLAGS} ${CFLAGS} -c $<
CLEANFILES += *.o

kv: ${KV_O}
	${CC} ${CFLAGS} ${LDFLAGS} ${KV_O} -o kv
CLEANFILES += kv

clean:
	rm -rf ${CLEANFILES}

.PHONY: all build clean libkv
Download