pinebuds/scripts/build.mk

528 lines
14 KiB
Makefile
Raw Normal View History

2022-08-15 04:20:27 -05:00
cur_makefile := $(lastword $(MAKEFILE_LIST))
# ==========================================================================
# Building
# ==========================================================================
src := $(obj)
PHONY := __build
__build:
$(cur_makefile): ;
# Init all relevant variables used in kbuild files so
# 1) they have correct type
# 2) they do not inherit any value from the environment
obj-y :=
lib-y :=
subdir-y :=
archive-custom :=
archive-custom-valid :=
always :=
targets :=
EXTRA_AFLAGS :=
EXTRA_CFLAGS :=
EXTRA_CPPFLAGS :=
EXTRA_LDFLAGS :=
asflags-y :=
ccflags-y :=
cppflags-y :=
ldflags-y :=
subdir-asflags-y :=
subdir-ccflags-y :=
include scripts/include.mk
# For backward compatibility check that these variables do not change
save-cflags := $(CFLAGS)
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
kbuild-file := $(kbuild-dir)/Makefile
include $(kbuild-file)
$(kbuild-file): ;
# If the save-* variables changed error out
ifeq ($(KBUILD_NOPEDANTIC),)
ifneq ("$(save-cflags)","$(CFLAGS)")
$(error CFLAGS was changed in "$(kbuild-file)". Fix it to use ccflags-y)
endif
endif
include scripts/lib.mk
ifeq ($(WIN_PLAT),y)
create_dir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1))
else
create_dir = [ -d $(1) ] || mkdir -p $(1)
endif
ifneq ($(KBUILD_SRC),)
# Create output directory if not already present
_dummy := $(shell $(call create_dir,$(obj)))
# Create directories for object files if directory does not exist
# Needed when obj-y := dir/file.o syntax is used
_dummy := $(foreach d,$(obj-dirs), $(shell $(call create_dir,$(d))))
endif
ifndef obj
$(warning kbuild: build.mk is included improperly)
endif
# ===========================================================================
ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
lib-target := $(obj)/lib.a
endif
ifneq ($(strip $(obj-y) $(obj-m) $(obj-) $(subdir-m) $(lib-target)),)
builtin-target := $(obj)/built-in$(built_in_suffix)
endif
submodgoals =
SUBMODS := $(filter $(obj)/%,$(SUBMODS))
ifneq ($(SUBMODS),)
lst_target := $(filter %.s %.i %.lst, $(SUBMODS))
ifeq ($(lib-target),)
ifneq ($(filter $(obj)/lib.lst,$(lst_target)),)
$(error Cannot make lib.lst: lib-target not exists)
endif
endif
ifeq ($(builtin-target),)
ifneq ($(filter $(obj)/built-in.lst,$(lst_target)),)
$(error Cannot make built-in.lst: builtin-target not exists)
endif
endif
lst_target_obj := $(lst_target)
lst_target_obj := $(filter-out $(obj)/built-in.lst $(obj)/lib.lst,$(lst_target_obj))
lst_target_obj := $(lst_target_obj:.s=.o)
lst_target_obj := $(lst_target_obj:.i=.o)
lst_target_obj := $(lst_target_obj:.lst=.o)
lst_target_obj := $(sort $(lst_target_obj))
cur_submods := $(filter-out $(lst_target),$(SUBMODS))
cur_submods += $(lst_target_obj)
include scripts/submods.mk
buildextra-y := $(filter $(cur_submods),$(extra-y))
ifeq ($(filter $(obj)/built-in.lst,$(lst_target)),)
# Just compile some of the object files
buildsubdir-y := $(call get_subdirs,$(subdir-y),$(cur_submods))
buildobj-y := $(filter $(cur_submods) $(addsuffix /built-in$(built_in_suffix),$(buildsubdir-y)),$(obj-y))
buildobj-y += $(foreach m,$(multi-used-y),$(if $(filter $(cur_submods),$(call get_multi_objs,$m))),$m,)
else
# Compile all the object files
buildsubdir-y := $(subdir-y)
buildobj-y := $(obj-y)
endif
ifeq ($(filter $(obj)/lib.lst,$(lst_target)),)
# Just compile some of the lib files
buildlib-y := $(filter $(cur_submods),$(lib-y))
else
# Compile all the lib files
buildlib-y := $(lib-y)
endif
# Check for invalid targets
errobj-y := $(cur_submods)
errobj-y := $(filter-out $(buildsubdir-y) $(addsuffix /%,$(buildsubdir-y)),$(errobj-y))
errobj-y := $(filter-out $(buildextra-y) $(buildobj-y) $(buildlib-y),$(errobj-y))
errobj-y := $(filter-out $(foreach m,$(multi-used-y),$(call get_multi_objs,$m)),$(errobj-y))
ifneq ($(errobj-y),)
$(warning Unknown targets in [$(obj)]: $(errobj-y))
endif
# Update lst targets
all_buildobj-y := $(buildextra-y) $(buildobj-y) $(filter-out %.a,$(builtin-target))
all_buildlib-y := $(filter %.a,$(builtin-target)) $(lib-target)
lst_target := $(filter $(lst_target), \
$(all_buildobj-y:.o=.s) \
$(all_buildobj-y:.o=.i) \
$(all_buildobj-y:.o=.lst) \
$(patsubst %.a,%.lst,$(all_buildlib-y)))
# Avoid .o compile error affecting .i generation
lst_i_target := $(filter %.i, $(lst_target))
ifneq ($(lst_i_target),)
$(lst_i_target:.i=.o) : | $(lst_i_target)
endif
ifeq ($(COMPILE_ONLY),1)
submodgoals = $(call get_submodgoals,$@,$(SUBMODS))
endif
else # SUBMODS
buildsubdir-y := $(subdir-y)
buildextra-y := $(extra-y)
buildobj-y := $(obj-y)
buildlib-y := $(lib-y)
endif # SUBMODS
archive-src-target :=
archive-custom-target :=
ifeq ($(GEN_LIB),1)
archive-src-target := $(addprefix $(srctree)/$(src)/lib/,$(notdir $(archive-src-y)))
archive-src-target += $(archive-custom-valid)
archive-src-target := $(strip $(archive-src-target))
archive-custom-target := $(addprefix $(srctree)/$(src)/lib/,$(notdir $(archive-custom-valid)))
endif
__build: $(builtin-target) $(lib-target) $(buildextra-y) $(buildsubdir-y) $(lst_target) $(archive-src-target) $(archive-custom-target) $(always)
@:
# Compile C sources (.c)
# ---------------------------------------------------------------------------
# Default is built-in, unless we know otherwise
quiet_modtag := $(empty) $(empty)
quiet_cmd_cc_dummy = CC $(quiet_modtag) $@
cmd_cc_dummy = $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -c -x c -o $@ $(devnull)
# For dummy object files. Recipe is: $(call if_changed,cc_dummy)
quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
$(obj)/%.s: $(src)/%.c FORCE
$(call if_changed_dep,cc_s_c)
quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
$(obj)/%.i: $(src)/%.c FORCE
$(call if_changed_dep,cc_i_c)
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
quiet_cmd_cc_o_c = CC $(quiet_modtag) $@
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
define rule_cc_o_c
$(call echo-cmd,cc_o_c) $(cmd_cc_o_c)
endef
# Built-in and composite module parts
$(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_rule,cc_o_c)
# Compile C++ sources (.cpp)
# ---------------------------------------------------------------------------
quiet_cmd_cc_s_c++ = C++ $(quiet_modtag) $@
cmd_cc_s_c++ = $(CC) $(c++_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
$(obj)/%.s: $(src)/%.cpp FORCE
$(call if_changed_dep,cc_s_c++)
$(obj)/%.s: $(src)/%.cc FORCE
$(call if_changed_dep,cc_s_c++)
quiet_cmd_cc_i_c++ = CPP $(quiet_modtag) $@
cmd_cc_i_c++ = $(CPP) $(c++_flags) -o $@ $<
$(obj)/%.i: $(src)/%.cpp FORCE
$(call if_changed_dep,cc_i_c++)
$(obj)/%.i: $(src)/%.cc FORCE
$(call if_changed_dep,cc_i_c++)
Squashed commit of the following: commit d21b9279462a63f292c8a6ef7d72f60bf83ea6df Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 29 11:12:31 2023 -0500 Switched from WAVs to MP3s commit 8a407aa29a6b636d8afe407089a80fc5a3f6e1b2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Fri Jan 27 07:35:00 2023 -0500 Re-added -j flag commit 654b56be791ba7e9ab7407a084601a0b4f8f9619 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:40:08 2023 -0500 Cleaned up build.mk commit 112175c3fe8168860908c5fcd1b2b8fea0493231 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:36:18 2023 -0500 Changed used variable names to match generated variable names commit 0dfe30e5b66185671eb85930c8a7f63b1880f0c7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 22 20:10:25 2023 -0500 Zeroth cut at a better sound build system that makes better use of the .o/.cpp build system commit f8131f371535e636b02b6aaef853154efff837aa Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:42:14 2023 -0500 Removed parallel make - this is the only way I found to get wav->txt to run before the .txt files are included elsewhere commit 934a42c0abd31e59bbebd6193a1db25e773d01ae Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:41:56 2023 -0500 Deleted some reference code commit 9d6a4c6638b6f74bd27f87af35451ad06de4cea8 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:39:02 2023 -0500 Fixed include error and absolute paths of generated .txt files commit ffc5d7178d8f4bbf4e76c91623c1aba85d83c1e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:38:29 2023 -0500 Added txt to the windows-only branch commit 1fea961998365c1483e23644cef60793cfe10e45 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 22:09:43 2023 -0500 Renamed wav objects for consistency commit e8d47b082a425074f0f16a29d0e54726aac1fa68 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 18:26:18 2023 -0500 Changed out.raw to out.sbc and commented out the usage of the sbcinfo command commit 2a0ff6569dd81f74f9f30714de8309013b4f8d9a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 20:37:29 2023 -0500 Added hash to out.raw so that `make -j` doesn't fail commit 80b2c18d5d848c216a76398ab615dace029506fd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 18:13:41 2023 -0500 Deleted .txt sounds and fixed Make system to make them! commit 319732a808d72dc70e03ebf8ce993ffdf7a01327 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:34:04 2023 -0500 Standardized out.raw name commit e48edd26d6a103e8b51c804416a3281122cde974 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:28:14 2023 -0500 Added .wav files to tracking commit 6a8c25eef4bf2ac477316629b37322188ba75762 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:26:33 2023 -0500 Force ffmpeg overwrite commit 03b50a544d579dadc573fb75e138ee0561d733f2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:45:41 2023 -0500 Removed extraneous slashes commit b4670dc68a274d572005d093e471e4a1c982ed16 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:44:41 2023 -0500 Added explicit verbosity commit 2c8cdeea6ecbfbffc7cc4dc4ccb1bd4ac50c7f8a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:11:02 2023 -0500 Annotate xxd command args commit 51d97b1033afcb561b89586fd7d8ffd78a35d43a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:04:04 2023 -0500 Added -aq audio quality flag to keep file sizes the same commit 1e2b28a42fa6752d181b69fa655a165195d8e8d6 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:03:48 2023 -0500 Fixed -ar audio rate flag commit 4b19a367acc4fc6ee47777bbf5560de2fbbf86e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:50:40 2023 -0500 Annotated ffmpeg args commit 363ad5ceffc7580843728cff2ae87450233a473c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:12:21 2023 -0500 Modified Makefile (system) to auto-build wav files from txt files NOTE: this is kind of the opposite of what we want, so the next step will be to reverse to order and build txt files from wave files each time instead commit 462a57a3ca2e328f3208c75468f68af4c946d42c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:46:43 2023 -0500 Added missing quotes commit 965a4b96d274b1e0b1aeb3fec400a55743765d25 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:43:01 2023 -0500 Updated convert.sh help message commit ef84de0b949e76e37b81db15da57f924777c30dd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:42:41 2023 -0500 Added output name to convert.sh
2023-01-29 10:16:07 -06:00
# Convert sounds (.mp3 to .txt)
# ---------------------------------------------------------------------------
%.snd.cpp: %.mp3 FORCE
../.././convert.sh -C $< $@
# $(call if_changed_dep,as_s_S) TODO! Reference, delete once implemented below
2022-08-15 04:20:27 -05:00
# C++ (.cpp) files
# The C++ file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c++ + relevant part of rule_cc_o_c)
quiet_cmd_cc_o_c++ = C++ $(quiet_modtag) $@
cmd_cc_o_c++ = $(C++) $(c++_flags) -c -o $@ $<
define rule_cc_o_c++
$(call echo-cmd,cc_o_c++) $(cmd_cc_o_c++)
endef
# Built-in and composite module parts
$(obj)/%.o: $(src)/%.cpp FORCE
$(call if_changed_rule,cc_o_c++)
$(obj)/%.o: $(src)/%.cc FORCE
$(call if_changed_rule,cc_o_c++)
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
cmd_as_s_S = $(CPP) $(a_cpp_flags) -o $@ $<
$(obj)/%.s: $(src)/%.S FORCE
$(call if_changed_dep,as_s_S)
quiet_cmd_as_o_S = AS $(quiet_modtag) $@
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
$(obj)/%.o: $(src)/%.S FORCE
$(call if_changed_dep,as_o_S)
targets += $(real-objs-y) $(real-objs-m) $(lib-y) $(lst_target)
targets += $(MAKECMDGOALS) $(always)
# Common list command
# ---------------------------------------------------------------------------
quiet_cmd_dump_lst_o = MKLST $@
ifeq ($(TOOLCHAIN),armclang)
cmd_dump_lst_o = $(OBJDUMP) --datasymbols --text -c -d --interleave=source --output=$@ $<
else
cmd_dump_lst_o = $(OBJDUMP) -Sdlxr $< > $@
endif
lst-cmd = @$(call echo-cmd,dump_lst_o) $(cmd_dump_lst_o)
$(obj)/%.lst: $(obj)/%.o
$(call lst-cmd)
# Build the compiled-in targets
# ---------------------------------------------------------------------------
# To build objects in subdirs, we need to descend into the directories
$(sort $(subdir-obj-y)): $(buildsubdir-y) ;
# Archive command
ifeq ($(TOOLCHAIN),armclang)
archive-cmd = $(AR) --create --debug_symbols $@ $(1)
else
ifeq ($(WIN_PLAT),y)
archive-cmd = ( ( echo create $@ && \
Squashed commit of the following: commit d21b9279462a63f292c8a6ef7d72f60bf83ea6df Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 29 11:12:31 2023 -0500 Switched from WAVs to MP3s commit 8a407aa29a6b636d8afe407089a80fc5a3f6e1b2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Fri Jan 27 07:35:00 2023 -0500 Re-added -j flag commit 654b56be791ba7e9ab7407a084601a0b4f8f9619 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:40:08 2023 -0500 Cleaned up build.mk commit 112175c3fe8168860908c5fcd1b2b8fea0493231 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:36:18 2023 -0500 Changed used variable names to match generated variable names commit 0dfe30e5b66185671eb85930c8a7f63b1880f0c7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 22 20:10:25 2023 -0500 Zeroth cut at a better sound build system that makes better use of the .o/.cpp build system commit f8131f371535e636b02b6aaef853154efff837aa Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:42:14 2023 -0500 Removed parallel make - this is the only way I found to get wav->txt to run before the .txt files are included elsewhere commit 934a42c0abd31e59bbebd6193a1db25e773d01ae Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:41:56 2023 -0500 Deleted some reference code commit 9d6a4c6638b6f74bd27f87af35451ad06de4cea8 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:39:02 2023 -0500 Fixed include error and absolute paths of generated .txt files commit ffc5d7178d8f4bbf4e76c91623c1aba85d83c1e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:38:29 2023 -0500 Added txt to the windows-only branch commit 1fea961998365c1483e23644cef60793cfe10e45 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 22:09:43 2023 -0500 Renamed wav objects for consistency commit e8d47b082a425074f0f16a29d0e54726aac1fa68 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 18:26:18 2023 -0500 Changed out.raw to out.sbc and commented out the usage of the sbcinfo command commit 2a0ff6569dd81f74f9f30714de8309013b4f8d9a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 20:37:29 2023 -0500 Added hash to out.raw so that `make -j` doesn't fail commit 80b2c18d5d848c216a76398ab615dace029506fd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 18:13:41 2023 -0500 Deleted .txt sounds and fixed Make system to make them! commit 319732a808d72dc70e03ebf8ce993ffdf7a01327 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:34:04 2023 -0500 Standardized out.raw name commit e48edd26d6a103e8b51c804416a3281122cde974 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:28:14 2023 -0500 Added .wav files to tracking commit 6a8c25eef4bf2ac477316629b37322188ba75762 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:26:33 2023 -0500 Force ffmpeg overwrite commit 03b50a544d579dadc573fb75e138ee0561d733f2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:45:41 2023 -0500 Removed extraneous slashes commit b4670dc68a274d572005d093e471e4a1c982ed16 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:44:41 2023 -0500 Added explicit verbosity commit 2c8cdeea6ecbfbffc7cc4dc4ccb1bd4ac50c7f8a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:11:02 2023 -0500 Annotate xxd command args commit 51d97b1033afcb561b89586fd7d8ffd78a35d43a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:04:04 2023 -0500 Added -aq audio quality flag to keep file sizes the same commit 1e2b28a42fa6752d181b69fa655a165195d8e8d6 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:03:48 2023 -0500 Fixed -ar audio rate flag commit 4b19a367acc4fc6ee47777bbf5560de2fbbf86e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:50:40 2023 -0500 Annotated ffmpeg args commit 363ad5ceffc7580843728cff2ae87450233a473c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:12:21 2023 -0500 Modified Makefile (system) to auto-build wav files from txt files NOTE: this is kind of the opposite of what we want, so the next step will be to reverse to order and build txt files from wave files each time instead commit 462a57a3ca2e328f3208c75468f68af4c946d42c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:46:43 2023 -0500 Added missing quotes commit 965a4b96d274b1e0b1aeb3fec400a55743765d25 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:43:01 2023 -0500 Updated convert.sh help message commit ef84de0b949e76e37b81db15da57f924777c30dd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:42:41 2023 -0500 Added output name to convert.sh
2023-01-29 10:16:07 -06:00
echo addmod $(subst $(space),$(comma),$(strip $(filter-out %.a %.cpp,$(1)))) && \
2022-08-15 04:20:27 -05:00
$(foreach o,$(filter %.a,$(1)),echo addlib $o && ) \
echo save && \
echo end ) | $(AR) -M )
else
# Command "/bin/echo -e" cannot work on Apple Mac machines, so we use "/usr/bin/printf" instead
archive-cmd = ( /usr/bin/printf 'create $@\n\
Squashed commit of the following: commit d21b9279462a63f292c8a6ef7d72f60bf83ea6df Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 29 11:12:31 2023 -0500 Switched from WAVs to MP3s commit 8a407aa29a6b636d8afe407089a80fc5a3f6e1b2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Fri Jan 27 07:35:00 2023 -0500 Re-added -j flag commit 654b56be791ba7e9ab7407a084601a0b4f8f9619 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:40:08 2023 -0500 Cleaned up build.mk commit 112175c3fe8168860908c5fcd1b2b8fea0493231 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 23 20:36:18 2023 -0500 Changed used variable names to match generated variable names commit 0dfe30e5b66185671eb85930c8a7f63b1880f0c7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Sun Jan 22 20:10:25 2023 -0500 Zeroth cut at a better sound build system that makes better use of the .o/.cpp build system commit f8131f371535e636b02b6aaef853154efff837aa Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:42:14 2023 -0500 Removed parallel make - this is the only way I found to get wav->txt to run before the .txt files are included elsewhere commit 934a42c0abd31e59bbebd6193a1db25e773d01ae Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:41:56 2023 -0500 Deleted some reference code commit 9d6a4c6638b6f74bd27f87af35451ad06de4cea8 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:39:02 2023 -0500 Fixed include error and absolute paths of generated .txt files commit ffc5d7178d8f4bbf4e76c91623c1aba85d83c1e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 23:38:29 2023 -0500 Added txt to the windows-only branch commit 1fea961998365c1483e23644cef60793cfe10e45 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 22:09:43 2023 -0500 Renamed wav objects for consistency commit e8d47b082a425074f0f16a29d0e54726aac1fa68 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Thu Jan 12 18:26:18 2023 -0500 Changed out.raw to out.sbc and commented out the usage of the sbcinfo command commit 2a0ff6569dd81f74f9f30714de8309013b4f8d9a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 20:37:29 2023 -0500 Added hash to out.raw so that `make -j` doesn't fail commit 80b2c18d5d848c216a76398ab615dace029506fd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 18:13:41 2023 -0500 Deleted .txt sounds and fixed Make system to make them! commit 319732a808d72dc70e03ebf8ce993ffdf7a01327 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:34:04 2023 -0500 Standardized out.raw name commit e48edd26d6a103e8b51c804416a3281122cde974 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:28:14 2023 -0500 Added .wav files to tracking commit 6a8c25eef4bf2ac477316629b37322188ba75762 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 17:26:33 2023 -0500 Force ffmpeg overwrite commit 03b50a544d579dadc573fb75e138ee0561d733f2 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:45:41 2023 -0500 Removed extraneous slashes commit b4670dc68a274d572005d093e471e4a1c982ed16 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:44:41 2023 -0500 Added explicit verbosity commit 2c8cdeea6ecbfbffc7cc4dc4ccb1bd4ac50c7f8a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:11:02 2023 -0500 Annotate xxd command args commit 51d97b1033afcb561b89586fd7d8ffd78a35d43a Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:04:04 2023 -0500 Added -aq audio quality flag to keep file sizes the same commit 1e2b28a42fa6752d181b69fa655a165195d8e8d6 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Tue Jan 10 08:03:48 2023 -0500 Fixed -ar audio rate flag commit 4b19a367acc4fc6ee47777bbf5560de2fbbf86e7 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:50:40 2023 -0500 Annotated ffmpeg args commit 363ad5ceffc7580843728cff2ae87450233a473c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 21:12:21 2023 -0500 Modified Makefile (system) to auto-build wav files from txt files NOTE: this is kind of the opposite of what we want, so the next step will be to reverse to order and build txt files from wave files each time instead commit 462a57a3ca2e328f3208c75468f68af4c946d42c Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:46:43 2023 -0500 Added missing quotes commit 965a4b96d274b1e0b1aeb3fec400a55743765d25 Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:43:01 2023 -0500 Updated convert.sh help message commit ef84de0b949e76e37b81db15da57f924777c30dd Author: Thatcher Chamberlin <j.thatcher.c@gmail.com> Date: Mon Jan 9 20:42:41 2023 -0500 Added output name to convert.sh
2023-01-29 10:16:07 -06:00
addmod $(subst $(space),$(comma),$(strip $(filter-out %.a %.cpp,$(1))))\n\
2022-08-15 04:20:27 -05:00
$(foreach o,$(filter %.a,$(1)),addlib $o\n)save\nend' | $(AR) -M )
endif
endif
# Archive check
ifeq ($(CHECK_LIB_SRC),1)
ifneq ($(archive-bin-y),)
$(info )
$(info Library source check OK: $(archive-bin-y))
$(info )
endif
ifneq ($(archive-src-y),)
$(info )
$(error Error: The source files exist for libraries: $(archive-src-y))
endif
endif
# Archive without source files
cmd_use_lib_file = $(call CMDCPFILE,$<,$@)
quiet_cmd_use_lib_file = USELIB $(@)
ifneq ($(archive-bin-y),)
ifeq ($(GEN_LIB),1)
$(info )
$(warning WARNING: No source files found for libraries: $(archive-bin-y))
$(info )
endif
$(archive-bin-y): $(obj)/%: $(srctree)/$(src)/lib/% FORCE
ifeq ($(FORCE_TO_USE_LIB),1)
$(call cmd,use_lib_file)
else
$(call if_changed,use_lib_file)
endif
targets += $(archive-bin-y)
endif # archive-bin-y
# Archive generation (with source files)
ifeq ($(GEN_LIB),1)
ifeq ($(FORCE_TO_USE_LIB),1)
$(error Conflicted options: GEN_LIB and FORCE_TO_USE_LIB)
endif
ifneq ($(archive-src-target),)
cmd_gen_lib_file = ( $(call create_dir,$(dir $(@))) ) && $(call archive-cmd,$(filter-out $(PHONY),$^))
quiet_cmd_gen_lib_file = GENLIB $(@)
define archive-src-target-rule
$(1): $(addprefix $(obj)/,$(patsubst %/,%/$(notdir $(builtin-target)),$($(notdir $(1:.a=-y)))))
endef
$(foreach m, $(archive-src-target), $(eval $(call archive-src-target-rule,$(m))))
$(archive-src-target): FORCE
ifeq ($(CHECK_GEN_LIB_DEP),1)
$(call if_changed,gen_lib_file)
else
# Always pack lib
$(call cmd,gen_lib_file)
endif
targets += $(archive-src-target)
endif # archive-src-y
endif # GEN_LIB
#
# Rule to compile a set of .o files into one .o/.a built-in file
#
ifdef builtin-target
ifeq ($(BUILT-IN-OBJ),1)
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o
ifeq ($(TOOLCHAIN),armclang)
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) -Wl$(comma)$(subst $(space),$(comma),$(strip $(ld_flags) --partial)) -nostdlib $(LINK_CFLAGS) -o $@ $(obj-y), \
$(call CMDRMFILE,$@) && $(AR) --create --debug_symbols $@)
else
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) -Wl$(comma)$(subst $(space),$(comma),$(strip $(ld_flags) -r)) -nostdlib -nostartfiles $(LINK_CFLAGS) -o $@ $(obj-y), \
$(call CMDRMFILE,$@) && $(AR) rcs$(KBUILD_ARFLAGS) $@)
endif
$(builtin-target): $(buildobj-y) FORCE
$(call if_changed,link_o_target)
else # BUILT-IN-OBJ
quiet_cmd_ar_o_target = AR $@
cmd_ar_o_target = $(call archive-cmd,$(obj-y))
$(builtin-target): $(buildobj-y) FORCE
$(call if_changed,ar_o_target)
endif # BUILT-IN-OBJ
targets += $(builtin-target)
$(obj)/built-in.lst: $(builtin-target)
$(call lst-cmd)
endif # builtin-target
#
# Rule to compile a set of .o files into one .a file
#
ifdef lib-target
quiet_cmd_link_l_target = AR $@
ifeq ($(TOOLCHAIN),armclang)
cmd_link_l_target = $(call CMDRMFILE,$@) && $(AR) --create --debug_symbols $@ $(lib-y)
else
cmd_link_l_target = $(call CMDRMFILE,$@) && $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
endif
$(lib-target): $(buildlib-y) FORCE
$(call if_changed,link_l_target)
targets += $(lib-target)
$(obj)/lib.lst: $(lib-target)
$(call lst-cmd)
endif
#
# Rule to link composite objects
#
# Composite objects are specified in kbuild makefile as follows:
# <composite-object>-objs := <list of .o files>
# or
# <composite-object>-y := <list of .o files>
link_multi_deps = \
$(filter $(addprefix $(obj)/, \
$($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@
ifeq ($(TOOLCHAIN),armclang)
cmd_link_multi-y = $(LD) -Wl,$(subst $(space),$(comma),$(strip $(ld_flags) --partial)) -nostdlib $(LINK_CFLAGS) -o $@ $(link_multi_deps)
else
cmd_link_multi-y = $(LD) -Wl,$(subst $(space),$(comma),$(strip $(ld_flags) -r --whole-archive)) -nostdlib -nostartfiles $(LINK_CFLAGS) -o $@ $(link_multi_deps)
endif
$(multi-used-y): FORCE
$(call if_changed,link_multi-y)
$(call multi_depend, $(multi-used-y), .o, -objs -y)
targets += $(multi-used-y)
$(multi-used-y:.o=.lst): %.lst : %.o
$(call lst-cmd)
# Descending
# ---------------------------------------------------------------------------
PHONY += $(subdir-y)
$(subdir-y):
$(Q)$(MAKE) $(build)=$@ $(submodgoals)
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
PHONY += FORCE
FORCE:
# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard $(foreach f,$(targets),$(call get_depfile_name,$(f))))
ifneq ($(cmd_files),)
include $(cmd_files)
$(cmd_files): ;
endif
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable se we can use it in if_changed and friends.
.PHONY: $(PHONY)
# Last-resort default rule for unknown targets
%::
@$(call echo-help,*** Error: No rule is defined for target: $@)
@exit 1