Debian Codegraph @

modules/lsp-lltl-lib/Makefile

raw
1 #!/usr/bin/make -f
2 #
3 # Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/>
4 # (C) 2026 Vladimir Sadovnikov <[email protected]>
5 #
6 # This file is part of lsp-lltl-lib
7 #
8 # lsp-lltl-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-lltl-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-lltl-lib. If not, see <https://www.gnu.org/licenses/>.
20 #
21
22 # Command-line flag to silence nested $(MAKE).
23 ifneq ($(VERBOSE),1)
24 .SILENT:
25 endif
26
27 # Location
28 BASEDIR := $(CURDIR)
29 MODULES := $(BASEDIR)/modules
30 BUILDDIR := $(BASEDIR)/.build
31 CONFIG := $(BASEDIR)/.config.mk
32
33 # Basic initialization
34 # Checks
35 ifeq ("$(wildcard $(CONFIG))", "")
36 CONFIGURED = 0
37 else
38 CONFIGURED = 1
39 endif
40
41 include $(BASEDIR)/project.mk
42
43 # Setup paths
44 CHK_CONFIG = test -f "$(CONFIG)" || (echo "System not properly configured. Please launch 'make config' first" && exit 1)
45 DISTSRC_PATH = $(BUILDDIR)/distsrc
46 DISTSRC = $(DISTSRC_PATH)/$(ARTIFACT_NAME)
47
48 .DEFAULT_GOAL := all
49 .PHONY: all compile install uninstall clean
50
51 compile all install uninstall:
52 $(CHK_CONFIG)
53 $(MAKE) -C "$(BASEDIR)/src" $(@) VERBOSE="$(VERBOSE)" CONFIG="$(CONFIG)" DESTDIR="$(DESTDIR)"
54
55 clean:
56 echo "Cleaning build directory $(BUILDDIR)"
57 -rm -rf $(BUILDDIR)
58 echo "Clean OK"
59
60 # Module-related tasks
61 .PHONY: fetch tree prune
62 fetch:
63 $(CHK_CONFIG)
64 echo "Fetching desired source code dependencies"
65 $(MAKE) -f "$(BASEDIR)/make/modules.mk" $(@) VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
66 echo "Fetch OK"
67
68 tree:
69 echo "Fetching all possible source code dependencies"
70 $(MAKE) -f "$(BASEDIR)/make/modules.mk" $(@) VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" TREE="1"
71 echo "Fetch OK"
72
73 prune: clean
74 echo "Pruning the whole project tree"
75 $(MAKE) -f "$(BASEDIR)/make/modules.mk" prune VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
76 $(MAKE) -f "$(BASEDIR)/make/modules.mk" prune VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" TREE="1"
77 -rm -rf "$(CONFIG)"
78 echo "Prune OK"
79
80 # Configuration-related targets
81 .PHONY: config help chkconfig
82
83 config:
84 $(MAKE) -f "$(BASEDIR)/make/configure.mk" $(@) VERBOSE="$(VERBOSE)" CONFIG="$(CONFIG)" -$(MAKEFLAGS)
85
86 # Release-related targets
87 .PHONY: distsrc
88 distsrc:
89 echo "Building source code archive"
90 mkdir -p "$(DISTSRC)/modules"
91 $(MAKE) -f "$(BASEDIR)/make/modules.mk" tree TREE="1" BUILD_FEATURES="$(FEATURES)" VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules"
92 cp -R $(BASEDIR)/include $(BASEDIR)/make $(BASEDIR)/src "$(DISTSRC)/"
93 cp $(BASEDIR)/CHANGELOG $(BASEDIR)/COPYING* $(BASEDIR)/Makefile $(BASEDIR)/*.mk "$(DISTSRC)/"
94 find "$(DISTSRC)" -iname '.git' | xargs rm -rf {}
95 find "$(DISTSRC)" -iname '.gitignore' | xargs rm -rf {}
96 tar -C $(DISTSRC_PATH) -czf "$(BUILDDIR)/$(ARTIFACT_NAME)-src-$(ARTIFACT_VERSION).tar.gz" "$(ARTIFACT_NAME)"
97 echo "Created archive: $(BUILDDIR)/$(ARTIFACT_NAME)-src-$(ARTIFACT_VERSION).tar.gz"
98 rm -rf $(DISTSRC_PATH)
99 echo "Build OK"
100
101 # Help
102 help:
103 echo "Available targets:"
104 echo " all Build all binaries"
105 echo " clean Clean all build files and configuration file"
106 echo " config Configure build"
107 echo " distsrc Make tarball with source code for packagers"
108 echo " fetch Fetch all desired source code dependencies from git"
109 echo " help Print this help message"
110 echo " info Output build configuration"
111 echo " install Install all binaries into the system"
112 echo " prune Cleanup build and all fetched dependencies from git"
113 echo " tree Fetch all possible source code dependencies from git"
114 echo " to make source code portable between machines"
115 echo " uninstall Uninstall binaries"
116 echo ""
117 $(MAKE) -f "$(BASEDIR)/make/configure.mk" $(@) VERBOSE="$(VERBOSE)"
118
119