Skip to content

Commit 6e8365b

Browse files
committed
Updated build
1 parent 475f1f9 commit 6e8365b

File tree

7 files changed

+184
-118
lines changed

7 files changed

+184
-118
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ clean:
5757
fetch:
5858
@$(CHK_CONFIG)
5959
@echo "Fetching desired source code dependencies"
60-
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
60+
@$(MAKE) -s -f "$(BASEDIR)/make/modules.mk" $(@) BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
6161
@echo "Fetch OK"
6262

6363
tree:
6464
@echo "Fetching all possible source code dependencies"
65-
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" TREE="1"
65+
@$(MAKE) -s -f "$(BASEDIR)/make/modules.mk" $(@) BASEDIR="$(BASEDIR)" TREE="1"
6666
@echo "Fetch OK"
6767

6868
prune: clean
6969
@echo "Pruning the whole project tree"
70-
@$(MAKE) -s -f "make/modules.mk" prune BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
71-
@$(MAKE) -s -f "make/modules.mk" prune BASEDIR="$(BASEDIR)" TREE="1"
70+
@$(MAKE) -s -f "$(BASEDIR)/make/modules.mk" prune BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
71+
@$(MAKE) -s -f "$(BASEDIR)/make/modules.mk" prune BASEDIR="$(BASEDIR)" TREE="1"
7272
@-rm -rf "$(CONFIG)"
7373
@echo "Prune OK"
7474

@@ -86,7 +86,7 @@ config:
8686
distsrc:
8787
@echo "Building source code archive"
8888
@mkdir -p "$(DISTSRC)/modules"
89-
@$(MAKE) -s -f "make/modules.mk" tree BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules" TREE="1"
89+
@$(MAKE) -s -f "$(BASEDIR)/make/modules.mk" tree BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules" TREE="1"
9090
@cp -R $(BASEDIR)/include $(BASEDIR)/make $(BASEDIR)/src "$(DISTSRC)/"
9191
@cp $(BASEDIR)/CHANGELOG $(BASEDIR)/COPYING* $(BASEDIR)/Makefile $(BASEDIR)/*.mk "$(DISTSRC)/"
9292
@find "$(DISTSRC)" -iname '.git' | xargs -exec rm -rf {}

dependencies.mk

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ LSP_TEST_FW_URL := https://github.com/sadko4u/$(LSP_TEST_FW_NAME).git
3131

3232
LSP_R3D_IFACE_VERSION := 0.5.1
3333
LSP_R3D_IFACE_NAME := lsp-r3d-iface
34-
LSP_R3D_IFACE_TYPE := hdr
34+
LSP_R3D_IFACE_TYPE := src
3535
LSP_R3D_IFACE_URL := https://github.com/sadko4u/$(LSP_R3D_IFACE_NAME).git
3636

37-
STDLIB_VERSION := system
38-
STDLIB_TYPE := opt
39-
STDLIB_LDFLAGS := -lpthread -ldl
37+
LIBPTHREAD_VERSION := system
38+
LIBPTHREAD_NAME := libpthread
39+
LIBPTHREAD_TYPE := opt
40+
LIBPTHREAD_LDFLAGS := -lpthread

make/configure.mk

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,24 @@ BINDIR := $(PREFIX)/bin
2525
INCDIR := $(PREFIX)/include
2626
BASEDIR := $(CURDIR)
2727
BUILDDIR := $(BASEDIR)/.build
28-
CONFIG := $(BASEDIR)/.config.mk
2928
MODULES := $(BASEDIR)/modules
29+
CONFIG := $(BASEDIR)/.config.mk
3030
TEST := 0
3131
DEBUG := 0
3232
PROFILE := 0
3333
TRACE := 0
3434

35+
include $(BASEDIR)/make/functions.mk
3536
include $(BASEDIR)/make/system.mk
36-
include $(BASEDIR)/project.mk
3737
include $(BASEDIR)/make/tools.mk
3838
include $(BASEDIR)/dependencies.mk
39+
include $(BASEDIR)/project.mk
3940

40-
DEPENDENCIES += $(TEST_DEPENDENCIES)
41+
# Compute the full list of dependencies
42+
UNIQ_DEPENDENCIES := $(call uniq, $(DEPENDENCIES) $(TEST_DEPENDENCIES))
43+
DEPENDENCIES = $(UNIQ_DEPENDENCIES)
4144

45+
# Determine versions
4246
ifeq ($(findstring -devel,$(ARTIFACT_VERSION)),-devel)
4347
$(foreach dep, $(DEPENDENCIES), \
4448
$(eval $(dep)_BRANCH=devel) \
@@ -116,23 +120,23 @@ define vardef =
116120
endef
117121

118122
# Define predefined variables
119-
ifndef $(ARTIFACT_VARS)_NAME
120-
$(ARTIFACT_VARS)_NAME := $(ARTIFACT_NAME)
123+
ifndef $(ARTIFACT_ID)_NAME
124+
$(ARTIFACT_ID)_NAME := $(ARTIFACT_NAME)
121125
endif
122-
ifndef $(ARTIFACT_VARS)_DESC
123-
$(ARTIFACT_VARS)_DESC := $(ARTIFACT_DESC)
126+
ifndef $(ARTIFACT_ID)_DESC
127+
$(ARTIFACT_ID)_DESC := $(ARTIFACT_DESC)
124128
endif
125-
ifndef $(ARTIFACT_VARS)_VERSION
126-
$(ARTIFACT_VARS)_VERSION := $(ARTIFACT_VERSION)
129+
ifndef $(ARTIFACT_ID)_VERSION
130+
$(ARTIFACT_ID)_VERSION := $(ARTIFACT_VERSION)
127131
endif
128-
ifndef $(ARTIFACT_VARS)_PATH
129-
$(ARTIFACT_VARS)_PATH := $(BASEDIR)
132+
ifndef $(ARTIFACT_ID)_PATH
133+
$(ARTIFACT_ID)_PATH := $(BASEDIR)
130134
endif
131135

132-
$(ARTIFACT_VARS)_TESTING = $(TEST)
133-
$(ARTIFACT_VARS)_TYPE := src
136+
$(ARTIFACT_ID)_TESTING = $(TEST)
137+
$(ARTIFACT_ID)_TYPE := src
134138

135-
OVERALL_DEPS := $(DEPENDENCIES) $(ARTIFACT_VARS)
139+
OVERALL_DEPS := $(DEPENDENCIES) $(ARTIFACT_ID)
136140
__tmp := $(foreach dep,$(OVERALL_DEPS),$(call vardef, $(dep)))
137141

138142
CONFIG_VARS = \

make/functions.mk

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
# (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
4+
#
5+
# This file is part of lsp-r3d-base-lib
6+
#
7+
# lsp-r3d-base-lib is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# any later version.
11+
#
12+
# lsp-r3d-base-lib is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with lsp-r3d-base-lib. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
# Deduplicates all strings in the list
22+
# $(call uniq, <list>)
23+
# $(call uniq, $(DEPENDENCIES))
24+
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
25+
26+
# Recursively lookup directory for specific file pattern
27+
# $(call rwildcard, <path>, <file-name-pattern>)
28+
# $(call rwildcard, main, *.cpp)
29+
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
30+
31+
# Fetch different flags from symbolic dependencies
32+
# $(call query, <field>, <list>)
33+
# $(call query, CFLAGS, $(DEPENDENCIES))
34+
query = $(foreach d,$(call uniq, $2),$($(d)_$(strip $1)))
35+
36+
# Fetch conditionally if dependency field is present
37+
# $(call dquery, <field>, <list>)
38+
# $(call dquery, OBJ, $(DEPENDENCIES))
39+
dquery = $(foreach d,$(call uniq, $2),$(if $($(d)_$(strip $1)),$(d)))
40+
41+
# Fetch different flags from symbolic dependencies
42+
# $(call cquery, <test-field>, <return-field>, <list>)
43+
# $(call cquery, OBJ_META, BIN, $(DEPENDENCIES))
44+
cquery = $(foreach d,$(call uniq, $3),$(if $($(d)_$(strip $1)),$($(d)_$(strip $2))))

make/modules.mk

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,45 @@
1818
# along with lsp-r3d-base-lib. If not, see <https://www.gnu.org/licenses/>.
1919
#
2020

21-
BASEDIR := $(CURDIR)
22-
CONFIG := $(CURDIR)/.config.mk
21+
BASEDIR := $(CURDIR)
22+
DEPLIST := $(BASEDIR)/dependencies.mk
23+
PROJECT := $(BASEDIR)/project.mk
24+
CONFIG := $(BASEDIR)/.config.mk
2325

24-
include $(BASEDIR)/dependencies.mk
25-
ifneq ($(TREE),1)
26+
include $(BASEDIR)/make/functions.mk
27+
ifeq ($(TREE),1)
28+
include $(DEPLIST)
29+
else
2630
-include $(CONFIG)
2731
endif
28-
include $(BASEDIR)/project.mk
32+
include $(PROJECT)
2933

30-
SYS_DEPENDENCIES = $(DEPENDENCIES) $(TEST_DEPENDENCIES)
34+
UNIQ_DEPENDENCIES = $(call uniq,$(DEPENDENCIES) $(TEST_DEPENDENCIES))
35+
UNIQ_ALL_DEPENDENCIES := $(call uniq,$(ALL_DEPENDENCIES))
3136

3237
# Find the proper branch of the GIT repository
3338
ifeq ($(TREE),1)
34-
MODULES := $(BASEDIR)/modules
35-
GIT := git
39+
MODULES := $(BASEDIR)/modules
40+
GIT := git
3641

3742
ifeq ($(findstring -devel,$(ARTIFACT_VERSION)),-devel)
38-
$(foreach dep, $(ALL_DEPENDENCIES), \
43+
$(foreach dep, $(UNIQ_ALL_DEPENDENCIES), \
3944
$(eval $(dep)_BRANCH=devel) \
4045
$(eval $(dep)_PATH=$(MODULES)/$($(dep)_NAME)) \
4146
)
4247
else
43-
$(foreach dep, $(ALL_DEPENDENCIES), \
48+
$(foreach dep, $(UNIQ_ALL_DEPENDENCIES), \
4449
$(eval $(dep)_BRANCH="$($(dep)_VERSION)") \
4550
$(eval $(dep)_PATH=$(MODULES)/$($(dep)_NAME)) \
4651
)
4752
endif
4853
endif
4954

5055
# Form list of modules, exclude all modules that have 'system' version
51-
SRC_MODULES = $(foreach dep, $(SYS_DEPENDENCIES), $(if $(findstring src,$($(dep)_TYPE)),$(dep)))
52-
HDR_MODULES = $(foreach dep, $(SYS_DEPENDENCIES), $(if $(findstring hdr,$($(dep)_TYPE)),$(dep)))
53-
ALL_SRC_MODULES = $(foreach dep, $(ALL_DEPENDENCIES), $(if $(findstring src,$($(dep)_TYPE)),$(dep)))
54-
ALL_HDR_MODULES = $(foreach dep, $(ALL_DEPENDENCIES), $(if $(findstring hdr,$($(dep)_TYPE)),$(dep)))
56+
SRC_MODULES = $(foreach dep, $(UNIQ_DEPENDENCIES), $(if $(findstring src,$($(dep)_TYPE)),$(dep)))
57+
HDR_MODULES = $(foreach dep, $(UNIQ_DEPENDENCIES), $(if $(findstring hdr,$($(dep)_TYPE)),$(dep)))
58+
ALL_SRC_MODULES = $(foreach dep, $(UNIQ_ALL_DEPENDENCIES), $(if $(findstring src,$($(dep)_TYPE)),$(dep)))
59+
ALL_HDR_MODULES = $(foreach dep, $(UNIQ_ALL_DEPENDENCIES), $(if $(findstring hdr,$($(dep)_TYPE)),$(dep)))
5560
ALL_PATHS = $(foreach dep, $(ALL_SRC_MODULES) $(ALL_HDR_MODULES), $($(dep)_PATH))
5661

5762
# Branches

project.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
#
2020

2121
# Package version
22+
ARTIFACT_ID = LSP_R3D_BASE_LIB
2223
ARTIFACT_NAME = lsp-r3d-base-lib
2324
ARTIFACT_DESC = Base library for implementing and loading 3D rendering backend
24-
ARTIFACT_VARS = LSP_R3D_BASE_LIB
2525
ARTIFACT_HEADERS = lsp-plug.in
2626
ARTIFACT_EXPORT_ALL = 0
2727
ARTIFACT_VERSION = 0.5.5-devel
2828

2929
# List of dependencies
30-
TEST_DEPENDENCIES = \
31-
LSP_TEST_FW
32-
3330
DEPENDENCIES = \
34-
STDLIB \
31+
LIBPTHREAD \
3532
LSP_COMMON_LIB \
3633
LSP_R3D_IFACE
3734

35+
TEST_DEPENDENCIES = \
36+
LSP_TEST_FW
37+
3838
ALL_DEPENDENCIES = \
3939
$(DEPENDENCIES) \
4040
$(TEST_DEPENDENCIES)

0 commit comments

Comments
 (0)