diff options
| -rw-r--r-- | Makefile | 35 | ||||
| -rw-r--r-- | aisa/aisa.cpp | 7 |
2 files changed, 22 insertions, 20 deletions
| @@ -9,15 +9,34 @@ CXXFLAGS := -Wall -Werror -std=c++20 -fPIC -iquote . ${OPTIMIZE} ${DEBUG} | |||
| 9 | libname = $(shell realpath --canonicalize-missing --relative-to . build/$(dir $(1))/lib$(notdir $(1))) | 9 | libname = $(shell realpath --canonicalize-missing --relative-to . build/$(dir $(1))/lib$(notdir $(1))) |
| 10 | 10 | ||
| 11 | PARTS := $(shell find * -type d -\( -name build -prune -o -name tools -prune -o -print -\)) | 11 | PARTS := $(shell find * -type d -\( -name build -prune -o -name tools -prune -o -print -\)) |
| 12 | PARTARS := $(foreach part, ${PARTS}, $(call libname, ${part}.a)) | 12 | PARTARS := |
| 13 | PARTSOS := $(foreach part, ${PARTS}, $(call libname, ${part}.so)) | 13 | PARTSOS := |
| 14 | 14 | ||
| 15 | MAINOBJS := $(patsubst %.cpp, build/%.o, $(wildcard *.cpp)) | 15 | MAINOBJS := $(patsubst %.cpp, build/%.o, $(wildcard *.cpp)) |
| 16 | MAINOBJS += build/git-tag.o | 16 | MAINOBJS += build/git-tag.o |
| 17 | 17 | ||
| 18 | HEADERS := $(find -type f -name \*.h) | 18 | HEADERS := $(find -type f -name \*.h) |
| 19 | 19 | ||
| 20 | all: issim | 20 | .DEFAULT: issim issim-static |
| 21 | |||
| 22 | define mklib = | ||
| 23 | |||
| 24 | ifneq ($(wildcard $(1)/*.cpp),) | ||
| 25 | |||
| 26 | $(call libname, $(1).a): $(patsubst %.cpp, build/%.o, $(wildcard $(1)/*.cpp)) | ||
| 27 | @mkdir -p $$(dir $$@) | ||
| 28 | $${AR} cr $$@ $$+ | ||
| 29 | |||
| 30 | $(call libname, $(1).so): $(patsubst %.cpp, build/%.o, $(wildcard $(1)/*.cpp)) | ||
| 31 | @mkdir -p $$(dir $$@) | ||
| 32 | $${CXX} $${CXXFLAGS} -shared -o $$@ $$+ | ||
| 33 | |||
| 34 | PARTARS += $(call libname, $(1).a) | ||
| 35 | PARTSOS += $(call libname, $(1).so) | ||
| 36 | |||
| 37 | endif | ||
| 38 | |||
| 39 | endef | ||
| 21 | 40 | ||
| 22 | issim: build/issim-dynamic | 41 | issim: build/issim-dynamic |
| 23 | @ln -sf $< $@ | 42 | @ln -sf $< $@ |
| @@ -54,16 +73,6 @@ build/%.o: build/%.cpp | |||
| 54 | @mkdir -p $(dir $@) | 73 | @mkdir -p $(dir $@) |
| 55 | ${CXX} ${CXXFLAGS} -MMD -c -o $@ $< | 74 | ${CXX} ${CXXFLAGS} -MMD -c -o $@ $< |
| 56 | 75 | ||
| 57 | define mklib = | ||
| 58 | $(call libname, $(1).a): $(patsubst %.cpp, build/%.o, $(wildcard $(1)/*.cpp)) | ||
| 59 | @mkdir -p $$(dir $$@) | ||
| 60 | $${AR} cr $$@ $$+ | ||
| 61 | |||
| 62 | $(call libname, $(1).so): $(patsubst %.cpp, build/%.o, $(wildcard $(1)/*.cpp)) | ||
| 63 | @mkdir -p $$(dir $$@) | ||
| 64 | $${CXX} $${CXXFLAGS} -shared -o $$@ $$+ | ||
| 65 | endef | ||
| 66 | |||
| 67 | $(foreach part, ${PARTS}, $(eval $(call mklib, ${part}))) | 76 | $(foreach part, ${PARTS}, $(eval $(call mklib, ${part}))) |
| 68 | 77 | ||
| 69 | .SUFFIXES: | 78 | .SUFFIXES: |
diff --git a/aisa/aisa.cpp b/aisa/aisa.cpp deleted file mode 100644 index 97a3b17..0000000 --- a/aisa/aisa.cpp +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | #include <iostream> | ||
| 2 | |||
| 3 | #include "aisa/aisa.h" | ||
| 4 | |||
| 5 | namespace aisa { | ||
| 6 | |||
| 7 | } | ||
