Removing make for cmake
This commit is contained in:
parent
99035d8a0f
commit
dfda0017d5
2 changed files with 0 additions and 180 deletions
68
Makefile
68
Makefile
|
@ -1,68 +0,0 @@
|
|||
# Build type (debug, sanitize, or release)
|
||||
BUILD_TYPE := debug
|
||||
|
||||
COMMON_CFLAGS = -Wall -Wextra -Wpedantic -std=c11 -fPIC -I.
|
||||
CFLAGS_DEBUG = $(COMMON_CFLAGS) -Og -g -DSPARSEMAP_DIAGNOSTIC -DDEBUG
|
||||
CFLAGS_SANITIZE = $(COMMON_CFLAGS) -Og -g -DSPARSEMAP_DIAGNOSTIC -DDEBUG -fsanitize=address,leak,object-size,pointer-compare,pointer-subtract,null,return,bounds,pointer-overflow,undefined -fsanitize-address-use-after-scope -std=c11
|
||||
CFLAGS_RELEASE = $(COMMON_CFLAGS) -Ofast
|
||||
CFLAGS_TEST = $(COMMON_CFLAGS) -Og -g -DDEBUG -I. -Itest
|
||||
CFLAGS := $(if $(filter debug,$(BUILD_TYPE)),$(CFLAGS_DEBUG), \
|
||||
$(if $(filter release,$(BUILD_TYPE)),$(CFLAGS_RELEASE), \
|
||||
$(if $(filter sanitize,$(BUILD_TYPE)),$(CFLAGS_SANITIZE), \
|
||||
$(error Unknown build type: $(BUILD_TYPE)))))
|
||||
|
||||
LDFLAGS = -lm
|
||||
LDFLAGS_VERBOSE = -Wl,-v
|
||||
|
||||
SRCS = $(wildcard *.c)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
STATIC_LIB = libsparsemap.a
|
||||
SHARED_LIB = libsparsemap.so
|
||||
TEST_TARGETS = test/test test/soak test/ex_1 test/ex_2 test/ex_3 test/ex_4
|
||||
TEST_SRCS = $(filter-out $(wildcard test/ex_*) test/midl.c $(TEST_TARGETS:=.c), $(wildcard test/*.c))
|
||||
TEST_OBJS = $(TEST_SRCS:.c=.o)
|
||||
TEST_DEPS = $(filter-out $(TEST_TARGETS:=.h), $(TEST_SRCS:.c=.h))
|
||||
|
||||
# Targets
|
||||
all: $(STATIC_LIB) $(SHARED_LIB)
|
||||
|
||||
info:
|
||||
$(info TEST_SRCS: $(TEST_SRCS))
|
||||
$(info TEST_OBJS: $(TEST_OBJS))
|
||||
$(info TEST_DEPS: $(TEST_DEPS))
|
||||
|
||||
$(STATIC_LIB): $(OBJS)
|
||||
ar rcs libsparsemap.a $(OBJS)
|
||||
|
||||
$(SHARED_LIB): $(OBJS)
|
||||
$(CC) -shared -o libsparsemap.so $(OBJS) $(LDFLAGS)
|
||||
|
||||
check: $(TEST_TARGETS)
|
||||
|
||||
test/test: $(TEST_OBJS) $(STATIC_LIB) test/test.o
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
test/soak: $(TEST_OBJS) $(STATIC_LIB) test/soak.o
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
test/ex_1: test/ex_1.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
test/ex_2: test/ex_2.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
test/ex_3: test/ex_3.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
test/ex_4: test/ex_4.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
$(TEST_OBJS): $(TEST_SRCS) $(TEST_DEPS)
|
||||
$(CC) $(CFLAGS_TEST) -c $(subst .o,.c,$@) -o $@
|
||||
|
||||
$(OBJS): $(SRCS)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f libsparsemap.a libsparsemap.so $(OBJS) $(TEST_OBJS) \
|
||||
test/test test/soak test/ex_1 test/ex_2 test/ex_3 test/ex_4
|
112
Makefile_
112
Makefile_
|
@ -1,112 +0,0 @@
|
|||
|
||||
OBJS = sparsemap.o
|
||||
STATIC_LIB = libsparsemap.a
|
||||
SHARED_LIB = libsparsemap.so
|
||||
|
||||
LIBS = -lm
|
||||
#CFLAGS = -Wall -Wextra -Wpedantic -Of -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -Wall -Wextra -Wpedantic -Og -g -std=c11 -Iinclude/ -fPIC
|
||||
CFLAGS = -DSPARSEMAP_DIAGNOSTIC -DDEBUG -Wall -Wextra -Wpedantic -O0 -g -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -DSPARSEMAP_DIAGNOSTIC -DDEBUG -Wall -Wextra -Ofast -g -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -Wall -Wextra -Wpedantic -Og -g -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -Wall -Wextra -Wpedantic -Ofast -g -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -DSPARSEMAP_DIAGNOSTIC -DDEBUG -Wall -Wextra -Wpedantic -Og -g -fsanitize=address,leak,object-size,pointer-compare,pointer-subtract,null,return,bounds,pointer-overflow,undefined -fsanitize-address-use-after-scope -std=c11 -Iinclude/ -fPIC
|
||||
#CFLAGS = -Wall -Wextra -Wpedantic -Og -g -fsanitize=all -fhardened -std=c11 -Iinclude/ -fPIC
|
||||
|
||||
TEST_FLAGS = -DDEBUG -Wall -Wextra -Wpedantic -O0 -g -std=c11 -Iinclude/ -Ilib/ -fPIC
|
||||
#TEST_FLAGS = -Wall -Wextra -Wpedantic -Ofast -g -std=c11 -Iinclude/ -Ilib/ -fPIC
|
||||
#TEST_FLAGS = -Wall -Wextra -Wpedantic -Og -g -std=c11 -Iinclude/ -Ilib/ -fPIC
|
||||
#TEST_FLAGS = -DDEBUG -Wall -Wextra -Wpedantic -Og -g -fsanitize=address,leak,object-size,pointer-compare,pointer-subtract,null,return,bounds,pointer-overflow,undefined -fsanitize-address-use-after-scope -std=c11 -Iinclude/ -fPIC
|
||||
|
||||
TESTS = tests/test tests/soak
|
||||
LIB_SRCS = $(wildcard lib/*.c)
|
||||
LIB_OBJS = $(SRCS:.c=.o)
|
||||
EXAMPLES = examples/ex_1 examples/ex_2 examples/ex_3 examples/ex_4
|
||||
|
||||
.PHONY: all shared static clean test examples mls
|
||||
|
||||
all: static shared
|
||||
|
||||
static: $(STATIC_LIB)
|
||||
|
||||
shared: $(SHARED_LIB)
|
||||
|
||||
$(STATIC_LIB): $(OBJS)
|
||||
ar rcs $(STATIC_LIB) $?
|
||||
|
||||
$(SHARED_LIB): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $? -shared
|
||||
|
||||
examples: $(STATIC_LIB) $(LIB_OBJS) $(EXAMPLES)
|
||||
|
||||
mls: examples/mls
|
||||
|
||||
tests: $(TESTS)
|
||||
|
||||
test: tests
|
||||
env ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./tests/test
|
||||
|
||||
soak: tests
|
||||
env ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./tests/soak
|
||||
|
||||
fuzzer: tests
|
||||
env ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./tests/fuzzer ./crash.case
|
||||
|
||||
lib/common.o: lib/common.h
|
||||
lib/munit.o: lib/munit.h
|
||||
lib/tdigest.o: lib/tdigest.h
|
||||
lib/roaring.o: lib/roaring.h
|
||||
lib/qc.o: lib/qc.h
|
||||
|
||||
tests/test: $(LIB_OBJS) $(STATIC_LIB) tests/test.o
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm -f examples/main.c
|
||||
rm -f $(STATIC_LIB) $(SHARED_LIB)
|
||||
rm -f $(TESTS) tests/*.o lib/*.o
|
||||
rm -f $(EXAMPLES) examples/*.o
|
||||
|
||||
format:
|
||||
clang-format -i src/sparsemap.c include/sparsemap.h examples/ex_*.c tests/soak.c tests/test.c tests/midl.c lib/common.c include/common.h
|
||||
# clang-format -i include/*.h src/*.c tests/*.c tests/*.h examples/*.c
|
||||
|
||||
%.o: src/%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $^
|
||||
|
||||
lib/%.o: lib/%.c
|
||||
$(CC) $(TEST_CFLAGS) -c -o $@ $^
|
||||
|
||||
tests/%.o: tests/%.c
|
||||
$(CC) $(TEST_CFLAGS) -c -o $@ $^
|
||||
|
||||
examples/%.o: examples/%.c
|
||||
$(CC) $(TEST_CFLAGS) -c -o $@ $^
|
||||
|
||||
examples/ex_1: $(TEST_OBJS) examples/ex_1.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
examples/ex_2: $(TEST_OBJS) examples/ex_2.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
examples/ex_3: $(TEST_OBJS) examples/ex_3.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
examples/ex_4: $(TEST_OBJS) examples/ex_4.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
tests/soak: $(TEST_OBJS) tests/soak.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS)
|
||||
|
||||
tests/fuzzer: $(TEST_OBJS) tests/fuzzer.o $(STATIC_LIB)
|
||||
$(CC) $^ $(LIBS) -o $@ $(TEST_FLAGS) -DFUZZ_DEBUG
|
||||
|
||||
todo:
|
||||
rg -i 'todo|gsb|abort'
|
||||
|
||||
# cp src/sparsemap.c /tmp && clang-tidy src/sparsemap.c -fix -fix-errors -checks="readability-braces-around-statements" -- -DDEBUG -DSPARSEMAP_DIAGNOSTIC -DSPARSEMAP_ASSERT -Wall -Wextra -Wpedantic -Og -g -std=c11 -Iinclude/ -fPIC
|
||||
|
||||
# clear; make clean examples test && env ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./tests/test
|
||||
|
||||
# clear; make clean examples test && env ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./examples/soak
|
Loading…
Reference in a new issue