26 lines
875 B
Makefile
26 lines
875 B
Makefile
.RECIPEPREFIX = >
|
|
.DEFAULT_GOAL = build/main.out
|
|
CXX = clang++
|
|
CXXFLAGS += -std=c++26 -Wno-experimental-header-units
|
|
LDFLAGS += -std=c++26
|
|
SYSTEMHEADER_FLAGS = -Wno-deprecated-builtins -Wno-pragma-system-header-outside-header -Wno-keyword-compat
|
|
build_module_path = $(let first rest,$1,$(if $(rest),-fmodule-file=$(first) $(call build_module_path,$(rest)),-fmodule-file=$(first)))
|
|
|
|
build/main.out: build/main.o
|
|
> $(CXX) $(LDFLAGS) $^ -o $@
|
|
|
|
build/main.o: main.cxx build/print.pcm build/type_traits.pcm
|
|
> $(CXX) $(CXXFLAGS) -c $(filter-out %.pcm,$^) $(call build_module_path,$(filter %.pcm,$^))
|
|
> @mv $(patsubst build/%,%,$@) $@
|
|
|
|
build/%.pcm:
|
|
> $(CXX) $(CXXFLAGS) -xc++-system-header --precompile $(patsubst build/%.pcm,%,$@) -o $@ $(SYSTEMHEADER_FLAGS)
|
|
|
|
.PHONY: clean run
|
|
clean:
|
|
> @-rm -rf ./build/*
|
|
bear: clean
|
|
> bear -- $(MAKE)
|
|
|
|
run: $(.DEFAULT_GOAL)
|
|
> @./$(.DEFAULT_GOAL)
|