39 lines
921 B
Makefile
39 lines
921 B
Makefile
CFLAGS ?= -Wall -Wextra -g -O1
|
|
LDFLAGS ?= -g -O1
|
|
LIB_CFLAGS ?= -fpic
|
|
LIB_LDFLAGS ?= -shared
|
|
GARGOYLE_OBJS := delusion gargoyle scribe sleuth twine
|
|
GARGOYLE_TEST_OBJS := runner gargoyle scribe sleuth twine
|
|
#GARGOYLE_TEST_OBJS := runner $(GARGOYLE_OBJS)
|
|
|
|
.PHONY: all gargoyle init docs test clean
|
|
|
|
all: gargoyle
|
|
|
|
gargoyle: bin/libgargoyle.so
|
|
|
|
init: bin
|
|
|
|
bin:
|
|
mkdir -p -- bin/test
|
|
|
|
bin/libgargoyle.so: $(addprefix bin/,$(addsuffix .o,$(GARGOYLE_OBJS)))
|
|
cc $(LDFLAGS) $(LIB_LDFLAGS) -o $@ $^
|
|
|
|
bin/%.o: src/%.c | init
|
|
cc $(CFLAGS) $(LIB_CFLAGS) -std=c99 -I include -c -o $@ $<
|
|
|
|
docs:
|
|
@printf "not implemented yet.\n" >&2
|
|
|
|
test: bin/libgargoyle.so bin/gargoyle-test
|
|
bin/gargoyle-test
|
|
|
|
bin/gargoyle-test: $(addprefix bin/test/,$(addsuffix .o,$(GARGOYLE_TEST_OBJS)))
|
|
cc $(LDFLAGS) -L bin -o $@ $^ -l gargoyle -l cunit -l m
|
|
|
|
bin/test/%.o: test/%.c | init
|
|
cc $(CFLAGS) -std=c99 -I include -c -o $@ $<
|
|
|
|
clean:
|
|
rm -rf -- bin
|