feat: add base bin targets
This commit is contained in:
parent
7173c09cb6
commit
91d6d55a74
52
Makefile
52
Makefile
@ -1,26 +1,64 @@
|
||||
build_dir?=build
|
||||
src_dir?=src
|
||||
tst_dir?=tst
|
||||
install_dir?=install
|
||||
|
||||
bins?= \
|
||||
01-main \
|
||||
02-switch \
|
||||
03-equity \
|
||||
11-join \
|
||||
12-join-main \
|
||||
21-create-many \
|
||||
22-create-many-recursive \
|
||||
23-create-many-once \
|
||||
31-switch-many \
|
||||
32-switch-many-join \
|
||||
33-switch-many-cascade \
|
||||
51-fibonacci \
|
||||
61-mutex \
|
||||
62-mutex \
|
||||
71-preemption \
|
||||
81-deadlock
|
||||
|
||||
bins_target=$(addprefix ${build_dir}/,${bins})
|
||||
|
||||
src_dirs=$(sort $(dir $(wildcard ${src_dir}/**/)))
|
||||
includes=$(patsubst %,-I%,${src_dirs})
|
||||
CFLAGS+=-g -O0 -std=c99 ${includes}
|
||||
CFLAGS+=-g -O0 -std=c99 ${includes} -lpthread
|
||||
LDFLAGS+=
|
||||
|
||||
srcs+=$(wildcard ${src_dir}/*.c ${src_dir}/**/*.c)
|
||||
objs+=$(patsubst ${src_dir}/%.c,${build_dir}/%.o,${srcs})
|
||||
objs+=$(patsubst %.c,${build_dir}/%.o,${srcs})
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
.PHONY: build
|
||||
build: main
|
||||
.PHONY: install
|
||||
install: build
|
||||
true
|
||||
|
||||
main: ${objs}
|
||||
.PHONY: graphs
|
||||
graphs:
|
||||
true
|
||||
|
||||
.PHONY: valgrind
|
||||
valgrind: build
|
||||
valgrind --leak-check=full --show-reachable=yes --track-origins=yes
|
||||
|
||||
.PHONY: build
|
||||
build: ${bins_target}
|
||||
|
||||
.PHONY: check
|
||||
check:
|
||||
true
|
||||
|
||||
${bins_target}: ${build_dir}/%: ${objs} ${build_dir}/${tst_dir}/%.o
|
||||
${CC} -o $@ $^ ${CFLAGS} ${LDFLAGS}
|
||||
|
||||
${build_dir}/%.o: ${src_dir}/%.c
|
||||
${build_dir}/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
${CC} -c -o $@ $^ ${CFLAGS}
|
||||
${CC} -o $@ -c $^ ${CFLAGS}
|
||||
|
||||
.PHONY: compile_flags.txt
|
||||
compile_flags.txt:
|
||||
|
Loading…
x
Reference in New Issue
Block a user