From 9890630b79f9d664da7eb5c2a86ea964273cc0b8 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 4 Oct 2022 23:02:18 +0300 Subject: [PATCH] chore: improve lsproj compilation --- scripts/common.mak | 13 ++++++++----- scripts/lsproj.mak | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 scripts/lsproj.mak diff --git a/scripts/common.mak b/scripts/common.mak index aa84cb6..3b3e241 100644 --- a/scripts/common.mak +++ b/scripts/common.mak @@ -1,12 +1,12 @@ -$(shell $(call mkdir,$(bin))) -$(shell $(CXX) $(src)/lsproj.cc -o $(bin)/lsproj$(exe)) +export lsproj = $(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)) 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 \ - $(foreach dep, $(shell ./$(bin)/lsproj$(exe) $(src) $1 deps),\ + $(foreach dep, $(shell ./$(lsproj) $(src) $1 deps),\ $(if $(wildcard src/$(dep)),\ $(dep),\ $(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) 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 .PRECIOUS: $(bin)/%.o diff --git a/scripts/lsproj.mak b/scripts/lsproj.mak new file mode 100644 index 0000000..6d49d5a --- /dev/null +++ b/scripts/lsproj.mak @@ -0,0 +1,3 @@ +$(lsproj): $(src)/lsproj.cc + $(call mkdir,$(dir $@)) + $(CXX) $^ -o $@ \ No newline at end of file