1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#!/usr/bin/make -f
#
# Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com>
#
# This file is part of lsp-plugins-loud-comp
#
# lsp-plugins-loud-comp is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# lsp-plugins-loud-comp is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with lsp-plugins-loud-comp. If not, see <https://www.gnu.org/licenses/>.
#
# Command-line flag to silence nested $(MAKE).
ifneq ($(VERBOSE),1)
.SILENT:
endif
# Location
BASEDIR := $(CURDIR)
MODULES := $(BASEDIR)/modules
BUILDDIR := $(BASEDIR)/.build
CONFIG := $(BASEDIR)/.config.mk
PLUGINS := $(BASEDIR)/plugins.mk
PROJECT := $(BASEDIR)/project.mk
# Basic initialization
# Checks
ifeq ("$(wildcard $(CONFIG))", "")
CONFIGURED = 0
else
CONFIGURED = 1
endif
include $(BASEDIR)/project.mk
# Setup paths
CHK_CONFIG = test -f "$(CONFIG)" || (echo "System not properly configured. Please launch 'make config' first" && exit 1)
DISTSRC_PATH = $(BUILDDIR)/distsrc
DISTSRC = $(DISTSRC_PATH)/$(ARTIFACT_NAME)
DISTSRC_DIRS = \
$(if $(wildcard $(BASEDIR)/include/*), $(BASEDIR)/include) \
$(if $(wildcard $(BASEDIR)/src/*), $(BASEDIR)/src) \
$(if $(wildcard $(BASEDIR)/make/*), $(BASEDIR)/make) \
$(if $(wildcard $(BASEDIR)/res/*), $(BASEDIR)/res)
DISTSRC_FILES = \
$(wildcard $(BASEDIR)/CHANGELOG) \
$(wildcard $(BASEDIR)/COPYING*) \
$(wildcard $(BASEDIR)/*LICENSE*) \
$(wildcard $(BASEDIR)/Makefile) \
$(wildcard $(BASEDIR)/*.mk) \
$(wildcard $(BASEDIR)/*.md) \
$(wildcard $(BASEDIR)/*.txt)
.DEFAULT_GOAL := all
.PHONY: all compile install uninstall clean package
compile all install uninstall package:
$(CHK_CONFIG)
$(MAKE) -C "$(BASEDIR)/src" $(@) VERBOSE="$(VERBOSE)" CONFIG="$(CONFIG)" DESTDIR="$(DESTDIR)"
clean:
echo "Cleaning build directory $(BUILDDIR)"
-rm -rf $(BUILDDIR)
echo "Clean OK"
# Module-related tasks
.PHONY: fetch tree prune
fetch:
$(CHK_CONFIG)
echo "Fetching desired source code dependencies"
$(MAKE) -f "make/modules.mk" $(@) VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
echo "Fetch OK"
tree:
echo "Fetching all possible source code dependencies"
$(MAKE) -f "make/modules.mk" $(@) VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" TREE="1"
echo "Fetch OK"
prune: clean
echo "Pruning the whole project tree"
$(MAKE) -f "make/modules.mk" prune VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)"
$(MAKE) -f "make/modules.mk" prune VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" TREE="1"
-rm -rf "$(CONFIG)"
echo "Prune OK"
# Configuration-related targets
.PHONY: config testconfig devel help chkconfig
config: CONFIG_FLAGS=
testconfig: CONFIG_FLAGS=TEST=1
devel: CONFIG_FLAGS=TEST=1 DEVEL=1
config testconfig devel:
$(MAKE) -f "make/configure.mk" config VERBOSE="$(VERBOSE)" CONFIG="$(CONFIG)" -$(MAKEFLAGS)
# Release-related targets
.PHONY: distsrc
distsrc:
echo "Building source code archive"
mkdir -p "$(DISTSRC)/modules"
$(MAKE) -f "make/modules.mk" tree VERBOSE="$(VERBOSE)" BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules" TREE="1"
$(if $(DISTSRC_DIRS), cp -R $(DISTSRC_DIRS) "$(DISTSRC)/")
$(if $(DISTSRC_FILES), cp $(DISTSRC_FILES) "$(DISTSRC)/")
find "$(DISTSRC)" -iname '.git' | xargs rm -rf {}
find "$(DISTSRC)" -iname '.gitignore' | xargs rm -rf {}
tar -C $(DISTSRC_PATH) -czf "$(BUILDDIR)/$(ARTIFACT_NAME)-src-$(ARTIFACT_VERSION).tar.gz" "$(ARTIFACT_NAME)"
echo "Created archive: $(BUILDDIR)/$(ARTIFACT_NAME)-src-$(ARTIFACT_VERSION).tar.gz"
rm -rf $(DISTSRC_PATH)
echo "Build OK"
# Help
help:
echo "Available targets:"
echo " all Build all binaries"
echo " clean Clean all build files and configuration file"
echo " config Configure build"
echo " devel Configure build as development build"
echo " distsrc Make tarball with source code for packagers"
echo " fetch Fetch all desired source code dependencies from git"
echo " help Print this help message"
echo " info Output build configuration"
echo " install Install all binaries into the system"
echo " package Create archive files with binaries"
echo " prune Cleanup build and all fetched dependencies from git"
echo " testconfig Configure test build"
echo " tree Fetch all possible source code dependencies from git"
echo " to make source code portable between machines"
echo " uninstall Uninstall binaries"
echo ""
$(MAKE) -f "$(BASEDIR)/make/configure.mk" $(@) VERBOSE="$(VERBOSE)"
echo ""
echo "Available FEATURES:"
echo " clap CLAP plugin format binaries"
echo " doc Generate standalone HTML documentation"
echo " gst GStreamer plugins"
echo " jack Standalone JACK plugins"
echo " ladspa LADSPA plugins"
echo " lv2 LV2 plugins"
echo " ui Build plugins with UI"
echo " vst2 VST 2.x plugin binaries"
echo " vst3 VST 3.x plugin binaries"
echo " xdg Desktop integration icons"
|