chore: improve lsproj compilation

This commit is contained in:
TopchetoEU 2022-10-04 23:02:18 +03:00
parent 452884a74c
commit 9890630b79
2 changed files with 11 additions and 5 deletions

View File

@ -1,12 +1,12 @@
$(shell $(call mkdir,$(bin))) export lsproj = $(bin)/lsproj$(exe)
$(shell $(CXX) $(src)/lsproj.cc -o $(bin)/lsproj$(exe)) export flags += "-I$(inc)" -D$(OS) -DPPC_VERSION_MAJOR=$(version-major) -DPPC_VERSION_MINOR=$(version-minor) -DPPC_VERSION_BUILD=$(version-build)
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
uniq=$(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) uniq=$(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
modoutput=$(shell ./$(bin)/lsproj$(exe) $(src) $1 output) modoutput=$(shell ./$(lsproj) $(src) $1 output)
deps=$(strip \ deps=$(strip \
$(foreach dep, $(shell ./$(bin)/lsproj$(exe) $(src) $1 deps),\ $(foreach dep, $(shell ./$(lsproj) $(src) $1 deps),\
$(if $(wildcard src/$(dep)),\ $(if $(wildcard src/$(dep)),\
$(dep),\ $(dep),\
$(error The module '$(dep)' (dependency of '$1') doesn't exist)\ $(error The module '$(dep)' (dependency of '$1') doesn't exist)\
@ -31,7 +31,10 @@ sources = $(call rwildcard,$(src)/$1,*.cc)
headers = $(call rwildcard,$(inc),*.h) headers = $(call rwildcard,$(inc),*.h)
binaries = $(patsubst $(src)/%.cc,$(bin)/%.o,$(call sources,$1)) binaries = $(patsubst $(src)/%.cc,$(bin)/%.o,$(call sources,$1))
flags += "-I$(inc)" -D$(OS) -DPPC_VERSION_MAJOR=$(version-major) -DPPC_VERSION_MINOR=$(version-minor) -DPPC_VERSION_BUILD=$(version-build) ifneq ($(nolsproj),yes)
$(shell make -f scripts/lsproj.mak $(lsproj))
endif
.PHONY: build .PHONY: build
.PRECIOUS: $(bin)/%.o .PRECIOUS: $(bin)/%.o

3
scripts/lsproj.mak Normal file
View File

@ -0,0 +1,3 @@
$(lsproj): $(src)/lsproj.cc
$(call mkdir,$(dir $@))
$(CXX) $^ -o $@