2023-01-27 15:07:24 +00:00
|
|
|
export lsdep = $(bin)/lsdep$(exe)
|
2023-01-26 14:46:50 +00:00
|
|
|
export lsinc = $(bin)/lsinc$(exe)
|
2022-10-04 20:02:18 +00:00
|
|
|
export flags += "-I$(inc)" -D$(OS) -DPPC_VERSION_MAJOR=$(version-major) -DPPC_VERSION_MINOR=$(version-minor) -DPPC_VERSION_BUILD=$(version-build)
|
2022-09-19 07:34:19 +00:00
|
|
|
|
2023-01-27 15:07:24 +00:00
|
|
|
$(shell make -f scripts/ls.mak lsinc=$(lsinc) lsdep=$(lsdep) src=$(src) "flags=$(flags)" all)
|
2022-10-09 11:18:38 +00:00
|
|
|
|
2022-10-04 20:45:08 +00:00
|
|
|
rwildcard=$(foreach d, $(wildcard $(1:=/*)),\
|
|
|
|
$(call rwildcard,$d,$2)\
|
|
|
|
$(filter $(subst *,%,$2),$d)\
|
|
|
|
)
|
2022-09-19 07:34:19 +00:00
|
|
|
|
2023-01-27 15:07:24 +00:00
|
|
|
deps=$(shell $(lsdep) --dir=deps $1)
|
|
|
|
rdeps=$(shell $(lsdep) --dir=deps --rec $1)
|
2022-09-19 07:34:19 +00:00
|
|
|
|
2023-01-27 15:07:24 +00:00
|
|
|
frdeps=$(shell $(lsdep) --dir=deps --rec --transform=$(bin)/lib$(lib)*$(so) $1)
|
|
|
|
ldeps=$(shell $(lsdep) --dir=deps --transform=-l$(lib) $1)
|
2022-09-19 07:34:19 +00:00
|
|
|
|
|
|
|
modules = $(patsubst $(src)/%/,$(bin)/lib$(lib)%$(so),$(filter-out $(src)/$(mainmodule)/,$(wildcard $(src)/*/)))
|
|
|
|
sources = $(call rwildcard,$(src)/$1,*.cc)
|
2022-10-09 11:18:38 +00:00
|
|
|
headers = $(call rwildcard,$(inc),*.hh)
|
2022-10-04 20:45:08 +00:00
|
|
|
binaries = $(patsubst $(src)/%.cc,$(bin)/tmp/%.o,$(call sources,$1))
|
2022-09-19 07:34:19 +00:00
|
|
|
|
|
|
|
.PHONY: build
|
2022-10-04 20:45:08 +00:00
|
|
|
.PRECIOUS: $(bin)/tmp/%.o
|
2022-09-19 07:34:19 +00:00
|
|
|
|
|
|
|
build: $(binary)
|
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
2022-10-03 14:22:21 +00:00
|
|
|
$(binary): $$(call frdeps,$(mainmodule)) $$(call binaries,$(mainmodule))
|
2022-09-19 07:34:19 +00:00
|
|
|
$(call mkdir,$(dir $@))
|
2022-10-03 14:22:21 +00:00
|
|
|
$(CXX) $(flags) $(call binaries,$(mainmodule)) -o $@ $(ldflags) $(call ldeps,$(mainmodule)) -L$(bin) "-I$(inc)"
|
2022-10-22 12:19:05 +00:00
|
|
|
echo Compiling executable '$(notdir $(binary))'...
|
2022-09-19 07:34:19 +00:00
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
2022-10-03 14:22:21 +00:00
|
|
|
$(bin)/lib$(lib)%$(so): $$(call frdeps,$$*) $$(call binaries,$$*)
|
2022-09-19 07:34:19 +00:00
|
|
|
$(call mkdir,$(bin))
|
2022-10-03 14:22:21 +00:00
|
|
|
$(CXX) -shared -fPIC $(flags) $(call binaries,$*) -o $@ $(ldflags) $(call ldeps,$*) -L$(bin) "-I$(inc)"
|
2022-10-22 12:19:05 +00:00
|
|
|
echo Compiling library '$(notdir $@)'...
|
2022-09-19 07:34:19 +00:00
|
|
|
|
2023-01-27 12:03:14 +00:00
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(bin)/tmp/%.o: $(src)/%.cc $$(shell $(lsinc) $(inc) $(src)/%.cc)
|
2022-10-03 14:22:21 +00:00
|
|
|
$(call mkdir,$(dir $@))
|
|
|
|
$(CXX) -fPIC -c $(flags) $< -o $@
|
2022-10-22 12:19:05 +00:00
|
|
|
echo - Compiling '$*.cc'...
|