Skip to content

Commit 8574ea8

Browse files
committed
Updated makefiles
1 parent 1dbc5e3 commit 8574ea8

File tree

11 files changed

+1034
-36
lines changed

11 files changed

+1034
-36
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*******************************************************************************
44

55
=== 0.5.3 ===
6+
* Updated build scripts that now use tags without prefixes first.
7+
* Updated headers and license files to match LGPL3+ license.
8+
* Updated make files to produce static library, pkgconf file and source tree.
69

710
=== 0.5.2 ===
811
* Build updates.

COPYING

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE renamed to COPYING.LESSER

File renamed without changes.

Makefile

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
#!/usr/bin/make -f
2+
#
3+
# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
4+
# (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
5+
#
6+
# This file is part of lsp-r3d-base-lib
7+
#
8+
# lsp-r3d-base-lib is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU Lesser General Public License as published by
10+
# the Free Software Foundation, either version 3 of the License, or
11+
# any later version.
12+
#
13+
# lsp-r3d-base-lib is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Lesser General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Lesser General Public License
19+
# along with lsp-r3d-base-lib. If not, see <https://www.gnu.org/licenses/>.
20+
#
221

322
# Location
423
BASEDIR := $(CURDIR)
@@ -18,6 +37,8 @@ include $(BASEDIR)/project.mk
1837

1938
# Setup paths
2039
CHK_CONFIG = test -f "$(CONFIG)" || (echo "System not properly configured. Please launch 'make config' first" && exit 1)
40+
DISTSRC_PATH = $(BUILDDIR)/.distsrc
41+
DISTSRC = $(DISTSRC_PATH)/$(ARTIFACT_NAME)
2142

2243
.DEFAULT_GOAL := all
2344
.PHONY: all compile install uninstall depend clean
@@ -32,37 +53,66 @@ clean:
3253
@echo "Clean OK"
3354

3455
# Module-related tasks
35-
.PHONY: fetch prune
56+
.PHONY: fetch tree prune
3657
fetch:
37-
@echo "Fetching source code dependencies"
58+
@$(CHK_CONFIG)
59+
@echo "Fetching desired source code dependencies"
3860
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
3961
@echo "Fetch OK"
62+
63+
tree:
64+
@echo "Fetching all possible source code dependencies"
65+
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" TREE="1"
66+
@echo "Fetch OK"
4067

4168
prune: clean
4269
@echo "Pruning the whole project tree"
4370
@$(MAKE) -s -f "make/modules.mk" prune BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
71+
@$(MAKE) -s -f "make/modules.mk" prune BASEDIR="$(BASEDIR)" TREE="1"
4472
@-rm -rf "$(CONFIG)"
4573
@echo "Prune OK"
4674

4775
# Configuration-related targets
48-
.PHONY: config help
76+
.PHONY: config help chkconfig
4977

5078
testconfig:
5179
@$(MAKE) -s -f "$(BASEDIR)/make/configure.mk" $(@) CONFIG="$(CONFIG)" TEST="1" $(MAKEFLAGS)
5280

5381
config:
5482
@$(MAKE) -s -f "$(BASEDIR)/make/configure.mk" $(@) CONFIG="$(CONFIG)" $(MAKEFLAGS)
5583

84+
# Release-related targets
85+
.PHONY: distsrc
86+
distsrc:
87+
@echo "Building source code archive"
88+
@mkdir -p "$(DISTSRC)/modules"
89+
@$(MAKE) -s -f "make/modules.mk" tree BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules" TREE="1"
90+
@cp -R $(BASEDIR)/include $(BASEDIR)/make $(BASEDIR)/src "$(DISTSRC)/"
91+
@cp $(BASEDIR)/CHANGELOG $(BASEDIR)/COPYING* $(BASEDIR)/Makefile $(BASEDIR)/*.mk "$(DISTSRC)/"
92+
@find "$(DISTSRC)" -iname '.git' | xargs -exec rm -rf {}
93+
@find "$(DISTSRC)" -iname '.gitignore' | xargs -exec rm -rf {}
94+
@tar -C $(DISTSRC_PATH) -czf "$(BUILDDIR)/$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz" "$(ARTIFACT_NAME)"
95+
@echo "Created archive: $(BUILDDIR)/$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz"
96+
@ln -sf "$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz" "$(BUILDDIR)/$(ARTIFACT_NAME)-src.tar.gz"
97+
@echo "Created symlink: $(BUILDDIR)/$(ARTIFACT_NAME)-src.tar.gz"
98+
@rm -rf $(DISTSRC_PATH)
99+
@echo "Build OK"
100+
101+
# Help
56102
help:
57103
@echo "Available targets:"
58104
@echo " all Build all binaries"
59105
@echo " clean Clean all build files and configuration file"
60106
@echo " config Configure build"
61107
@echo " depend Update build dependencies for current project"
62-
@echo " fetch Fetch all source code dependencies from git"
108+
@echo " distsrc Make tarball with source code for packagers"
109+
@echo " fetch Fetch all desired source code dependencies from git"
63110
@echo " help Print this help message"
64111
@echo " info Output build configuration"
65112
@echo " install Install all binaries into the system"
113+
@echo " prune Cleanup build and all fetched dependencies from git"
114+
@echo " tree Fetch all possible source code dependencies from git"
115+
@echo " to make source code portable between machines"
66116
@echo " uninstall Uninstall binaries"
67117
@echo ""
68118
@$(MAKE) -s -f "$(BASEDIR)/make/configure.mk" $(@)

dependencies.mk

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
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+
121
# Variables that describe dependencies
2-
LSP_COMMON_LIB_VERSION := 1.0.7
22+
LSP_COMMON_LIB_VERSION := 1.0.8
323
LSP_COMMON_LIB_NAME := lsp-common-lib
424
LSP_COMMON_LIB_URL := https://github.com/sadko4u/$(LSP_COMMON_LIB_NAME).git
525
LSP_COMMON_LIB_TYPE := hdr
626

7-
LSP_TEST_FW_VERSION := 1.0.5
27+
LSP_TEST_FW_VERSION := 1.0.6
828
LSP_TEST_FW_NAME := lsp-test-fw
929
LSP_TEST_FW_URL := https://github.com/sadko4u/$(LSP_TEST_FW_NAME).git
1030
LSP_TEST_FW_TYPE := src

make/configure.mk

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
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+
121
# Definitions
222
PREFIX := /usr/local
23+
LIBDIR := $(PREFIX)/lib
24+
BINDIR := $(PREFIX)/bin
25+
INCDIR := $(PREFIX)/include
326
BASEDIR := $(CURDIR)
427
BUILDDIR := $(BASEDIR)/.build
528
CONFIG := $(BASEDIR)/.config.mk
@@ -26,7 +49,7 @@ ifeq ($(findstring -devel,$(ARTIFACT_VERSION)),-devel)
2649
else
2750
$(foreach dep, $(DEPENDENCIES), \
2851
$(eval \
29-
$(dep)_BRANCH="$($(dep)_NAME)-$($(dep)_VERSION)" \
52+
$(dep)_BRANCH="$($(dep)_VERSION)" \
3053
) \
3154
)
3255
endif
@@ -59,6 +82,7 @@ define srcconfig =
5982
$(eval name=$(1))
6083
$(eval builtin=$(patsubst $(ARTIFACT_NAME),,$($(name)_NAME)))
6184
$(if $($(name)_PATH),, $(eval $(name)_PATH := $(MODULES)/$($(name)_NAME)))
85+
$(if $($(name)_DESC),, $(eval $(name)_DESC := $($(name)_DESC)))
6286
$(if $($(name)_INC),, $(eval $(name)_INC := $($(name)_PATH)/include))
6387
$(if $($(name)_SRC),, $(eval $(name)_SRC := $($(name)_PATH)/src))
6488
$(if $($(name)_TEST),, $(eval $(name)_TEST := $($(name)_PATH)/test))
@@ -74,6 +98,7 @@ define hdrconfig =
7498
$(eval name=$(1))
7599
$(eval builtin=$(patsubst $(ARTIFACT_NAME),,$($(name)_NAME)))
76100
$(if $($(name)_PATH),, $(eval $(name)_PATH := $(MODULES)/$($(name)_NAME)))
101+
$(if $($(name)_DESC),, $(eval $(name)_DESC := $($(name)_DESC)))
77102
$(if $($(name)_INC),, $(eval $(name)_INC := $($(name)_PATH)/include))
78103
$(if $($(name)_TESTING),, $(eval $(name)_TESTING := 0))
79104
$(if $($(name)_CFLAGS),, $(eval $(name)_CFLAGS := "-I\"$($(name)_INC)\"" $(if $(builtin),"-D$(name)_BUILTIN")))
@@ -94,6 +119,9 @@ endef
94119
ifndef $(ARTIFACT_VARS)_NAME
95120
$(ARTIFACT_VARS)_NAME := $(ARTIFACT_NAME)
96121
endif
122+
ifndef $(ARTIFACT_VARS)_DESC
123+
$(ARTIFACT_VARS)_DESC := $(ARTIFACT_DESC)
124+
endif
97125
ifndef $(ARTIFACT_VARS)_VERSION
98126
$(ARTIFACT_VARS)_VERSION := $(ARTIFACT_VERSION)
99127
endif
@@ -112,6 +140,7 @@ CONFIG_VARS = \
112140
$(TOOL_VARS) \
113141
$(foreach name, $(OVERALL_DEPS), \
114142
$(name)_NAME \
143+
$(name)_DESC \
115144
$(name)_VERSION \
116145
$(name)_TYPE \
117146
$(name)_BRANCH \
@@ -148,6 +177,7 @@ help: | toolvars sysvars
148177
@echo " <ARTIFACT>_BIN location to put all binaries when building artifact"
149178
@echo " <ARTIFACT>_BRANCH git branch used to checkout source code"
150179
@echo " <ARTIFACT>_CFLAGS C/C++ flags to access headers of the artifact"
180+
@echo " <ARTIFACT>_DESC Full description of the artifact"
151181
@echo " <ARTIFACT>_INC path to include files of the artifact"
152182
@echo " <ARTIFACT>_LDFLAGS linker flags to link with artifact"
153183
@echo " <ARTIFACT>_MFLAGS artifact-specific compilation flags"

make/modules.mk

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,85 @@
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+
121
BASEDIR := $(CURDIR)
222
CONFIG := $(CURDIR)/.config.mk
323

4-
include $(CONFIG)
24+
include $(BASEDIR)/dependencies.mk
25+
ifneq ($(TREE),1)
26+
-include $(CONFIG)
27+
endif
528
include $(BASEDIR)/project.mk
629

7-
DEPENDENCIES += $(TEST_DEPENDENCIES)
30+
SYS_DEPENDENCIES = $(DEPENDENCIES) $(TEST_DEPENDENCIES)
31+
32+
# Find the proper branch of the GIT repository
33+
ifeq ($(TREE),1)
34+
MODULES := $(BASEDIR)/modules
35+
GIT := git
36+
37+
ifeq ($(findstring -devel,$(ARTIFACT_VERSION)),-devel)
38+
$(foreach dep, $(ALL_DEPENDENCIES), \
39+
$(eval $(dep)_BRANCH=devel) \
40+
$(eval $(dep)_PATH=$(MODULES)/$($(dep)_NAME)) \
41+
)
42+
else
43+
$(foreach dep, $(ALL_DEPENDENCIES), \
44+
$(eval $(dep)_BRANCH="$($(dep)_VERSION)") \
45+
$(eval $(dep)_PATH=$(MODULES)/$($(dep)_NAME)) \
46+
)
47+
endif
48+
endif
849

950
# Form list of modules, exclude all modules that have 'system' version
10-
SRC_MODULES = $(foreach dep, $(DEPENDENCIES), $(if $(findstring src,$($(dep)_TYPE)),$(dep)))
11-
HDR_MODULES = $(foreach dep, $(DEPENDENCIES), $(if $(findstring hdr,$($(dep)_TYPE)),$(dep)))
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)))
55+
ALL_PATHS = $(foreach dep, $(ALL_SRC_MODULES) $(ALL_HDR_MODULES), $($(dep)_PATH))
1256

1357
# Branches
14-
.PHONY: $(SRC_MODULES) $(HDR_MODULES)
58+
.PHONY: $(ALL_SRC_MODULES) $(ALL_HDR_MODULES) $(ALL_PATHS)
1559
.PHONY: fetch prune clean
1660

17-
$(SRC_MODULES) $(HDR_MODULES):
61+
$(ALL_SRC_MODULES) $(ALL_HDR_MODULES):
1862
@echo "Cloning $($(@)_URL) -> $($(@)_PATH) [$($(@)_BRANCH)]"
1963
@test -f "$($(@)_PATH)/.git/config" || $(GIT) clone "$($(@)_URL)" "$($(@)_PATH)"
2064
@$(GIT) -C "$($(@)_PATH)" reset --hard
2165
@$(GIT) -C "$($(@)_PATH)" fetch origin --force
2266
@$(GIT) -C "$($(@)_PATH)" fetch origin '+refs/heads/*:refs/tags/*' --force
2367
@$(GIT) -c advice.detachedHead=false -C "$($(@)_PATH)" checkout origin/$($(@)_BRANCH) || \
24-
$(GIT) -c advice.detachedHead=false -C "$($(@)_PATH)" checkout refs/tags/$($(@)_BRANCH)
68+
$(GIT) -c advice.detachedHead=false -C "$($(@)_PATH)" checkout refs/tags/$($(@)_BRANCH) || \
69+
$(GIT) -c advice.detachedHead=false -C "$($(@)_PATH)" checkout origin/$($(@)_NAME)-$($(@)_BRANCH) || \
70+
$(GIT) -c advice.detachedHead=false -C "$($(@)_PATH)" checkout refs/tags/$($(@)_NAME)-$($(@)_BRANCH)
71+
72+
$(ALL_PATHS):
73+
@echo "Removing $(notdir $(@))"
74+
@-rm -rf $(@)
2575

2676
fetch: $(SRC_MODULES) $(HDR_MODULES)
2777

78+
tree: $(ALL_SRC_MODULES) $(ALL_HDR_MODULES)
79+
2880
clean:
2981
@echo rm -rf "$($(ARTIFACT_VARS)_BIN)/$(ARTIFACT_NAME)"
3082
@-rm -rf "$($(ARTIFACT_VARS)_BIN)/$(ARTIFACT_NAME)"
3183

32-
prune:
33-
@-find 'modules' -mindepth 1 -maxdepth 1 -type d -exec rm -rf '{}' \;
84+
prune: $(ALL_PATHS)
3485

0 commit comments

Comments
 (0)