diff options
| author | Julian Blake Kongslie | 2022-06-23 17:46:19 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-06-23 17:46:19 -0700 |
| commit | e94cf0292758b8af5744c2331403580e1792acf7 (patch) | |
| tree | 984ffe5c6e50e0f42dcc5216e03b1cc9160e7cff /Makefile | |
| download | issim-e94cf0292758b8af5744c2331403580e1792acf7.tar.xz | |
Initial commit.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6d3a4ab --- /dev/null +++ b/Makefile | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | OPTIMIZE ?= -O3 | ||
| 2 | DEBUG ?= -g | ||
| 3 | |||
| 4 | AR ?= ar | ||
| 5 | CXX ?= g++ | ||
| 6 | |||
| 7 | CXXFLAGS := -Wall -Werror -std=c++20 -fPIC -iquote . ${OPTIMIZE} ${DEBUG} | ||
| 8 | |||
| 9 | PARTS := $(shell find * -type d -\( -name build -prune -o -print -\)) | ||
| 10 | PARTARS := $(addprefix build/lib, $(addsuffix .a, ${PARTS})) | ||
| 11 | PARTSOS := $(addprefix build/lib, $(addsuffix .so, ${PARTS})) | ||
| 12 | |||
| 13 | MAINOBJS := $(addprefix build/, $(addsuffix .o, $(basename $(wildcard *.cpp)))) | ||
| 14 | MAINOBJS += build/git-tag.o | ||
| 15 | |||
| 16 | all: issim | ||
| 17 | |||
| 18 | issim: build/issim-dynamic | ||
| 19 | @ln -sf $< $@ | ||
| 20 | .PHONY: issim | ||
| 21 | |||
| 22 | issim-static: build/issim-static | ||
| 23 | @ln -sf $< $@ | ||
| 24 | .PHONY: issim-static | ||
| 25 | |||
| 26 | build/issim-dynamic: ${MAINOBJS} ${PARTSOS} | ||
| 27 | @mkdir -p $(dir $@) | ||
| 28 | ${CXX} ${CXXFLAGS} -o $@ $+ | ||
| 29 | |||
| 30 | build/issim-static: ${MAINOBJS} ${PARTARS} | ||
| 31 | @mkdir -p $(dir $@) | ||
| 32 | ${CXX} ${CXXFLAGS} -o $@ $+ | ||
| 33 | |||
| 34 | clean: | ||
| 35 | rm -rf build issim issim-static | ||
| 36 | .PHONY: clean | ||
| 37 | |||
| 38 | build/git-tag.cpp: | ||
| 39 | @mkdir -p $(dir $@) | ||
| 40 | ./get-git-tag > $@ | ||
| 41 | .PHONY: build/git-tag.cpp | ||
| 42 | |||
| 43 | build/%.o: %.cpp Makefile | ||
| 44 | @mkdir -p $(dir $@) | ||
| 45 | ${CXX} ${CXXFLAGS} -c -o $@ $< | ||
| 46 | |||
| 47 | build/%.o: build/%.cpp Makefile | ||
| 48 | @mkdir -p $(dir $@) | ||
| 49 | ${CXX} ${CXXFLAGS} -c -o $@ $< | ||
| 50 | |||
| 51 | .SUFFIXES: | ||
| 52 | .SECONDARY: | ||
| 53 | |||
| 54 | .SECONDEXPANSION: | ||
| 55 | |||
| 56 | build/lib%.a: $$(addprefix build/, $$(addsuffix .o, $$(basename $$(wildcard %/*.cpp)))) | ||
| 57 | @mkdir -p $(dir $@) | ||
| 58 | ${AR} cr $@ $+ | ||
| 59 | |||
| 60 | build/lib%.so: $$(addprefix build/, $$(addsuffix .o, $$(basename $$(wildcard %/*.cpp)))) | ||
| 61 | @mkdir -p $(dir $@) | ||
| 62 | ${CXX} ${CXXFLAGS} -shared -o $@ $+ | ||
