aboutsummaryrefslogblamecommitdiff
path: root/Makefile
blob: ceaa80e58e3e795311e93e744ce584b7afe0cc1b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                
             







                                                                                

                                                                                           
 

                                                                                
 
                                                                                




                                     
                       






                                       


                                                                                
                  
                                  












                                                     
TEST += bitfield
TEST += option
TEST += timer

# -- INTERNALS -----------------------------------------------------------------

BINS = $(TEST:%=build/%)
DEPS = $(TEST:%=build/%.d)

# -- FLAGS ---------------------------------------------------------------------

DEPS_GEN  = -MMD
SANITIZER = -fsanitize=address -fsanitize=undefined -fsanitize=leak -fno-omit-frame-pointer

CXXFLAGS  = -Og -g -Wall -Wextra -Werror -I. -std=c++14 $(DEPS_GEN) $(SANITIZER)
LDFLAGS   = $(SANITIZER)

# -- RULES ---------------------------------------------------------------------

bear:
	bear intercept -- $(MAKE) all
	bear citnames

all: lint build $(BINS)

run: all
	@for BIN in $(BINS); do \
		echo "==> run $$BIN"; \
		$$BIN; \
	done

lint:
	clang-format --dry-run -Werror $(shell find -name '*.cc' -o -name '*.h')

build/%: build/%.o
	$(CXX) -o $@ $< $(LDFLAGS)

build/%.o: test/%.cc
	$(CXX) -c -o $@ $< $(CXXFLAGS)

build:
	mkdir -p build

clean:
	$(RM) -r build
	$(RM) compile_commands.json events.json

# Since DEPS files contain rules, include at the end.
-include $(DEPS)