gigaset_elements_bl26_opens.../src/Makefile

126 lines
3.1 KiB
Makefile

# File created by Gigaset Elements GmbH
# All rights reserved.
# by default build is for the hardware
export BUILD ?= hw
# configuration
include config.mk
# $(1) - directory with sources
# $(2) - target for make
define gigaset_make
if test -d $(TOP)/gigaset/$(1); then \
echo ; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo ; \
cd $(TOP)/gigaset/$(1); \
make $(2); \
else \
echo "Unknown sources $(1)"; \
exit 2; \
fi
endef
# $(1) - opensorce "package"
# $(2) - target for make
define opensource_make
if test -d $(TOP)/opensource/$(1); then \
echo ; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo ; \
cd $(TOP)/opensource; \
make OPENSOURCE=$(1) OUT=$(OUT)/opensource/$(1) $(2); \
else \
echo "Unknown sources $(1)"; \
exit 2; \
fi
endef
# $(1) - dialog "package"
# $(2) - target for make
define dialog_make
if test -d $(TOP)/dialog/$(1); then \
echo ; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo ; \
cd $(TOP)/dialog/; \
make DIALOG=$(1) OUT=$(OUT)/dialog/$(1) $(2); \
else \
echo "Unknown sources $(1)"; \
exit 2; \
fi
endef
# $(1) - rtx component to make
# $(2) - rtx component target to make
define rtx_make
if test -d $(TOP)/rtx/$(1); then \
echo ; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo "---- ==== make \"$(2)\" for \"$(1)\" ==== ----"; \
echo ; \
cd $(TOP)/rtx/$(1); \
make $(2); \
else \
echo "Unknown sources $(1)"; \
exit 2; \
fi
endef
# make selector
define make_for
@if [ -n "$(GIGA)" ]; then \
echo "Making GIGASET"; \
$(call gigaset_make,$(GIGA),$(1)); \
elif [ -n "$(DIALOG)" ]; then \
echo "Making DIALOG"; \
$(call dialog_make,$(DIALOG),$(1)); \
elif [ -n "$(RTX)" ]; then \
echo "Making RTX"; \
$(call rtx_make,$(RTX),$(1)); \
elif [ -n "$(OPENSOURCE)" ]; then \
echo "Making OPENSOURCE"; \
$(call opensource_make,$(OPENSOURCE),$(1)); \
else \
echo "Making target '$(1)' for $(BUILD) configuration"; \
make -f target.$(BUILD).mk $(1); \
fi;
endef
# any provided by user target goes here:
%:
@$(TOP)/../tools/make-check-commands.sh
@echo "Executing top-level Makefile default rule"
#NOTE: don't use BASH conditions:
@if [ "$@" != "baseline_tag" -a \
"$@" != "mrproper" -a \
"$@" != "clean" -a \
"$@" != "dirs" -a \
! -f $(OUT_COMMON)/$(LAST_INIT) ]; then \
echo "Last build was perfomerd for the other variant, so reconfiguration is necessary"; \
mkdir -p $(OUT_COMMON); \
rm -f $(OUT_COMMON)/$(LAST_INIT_REGEX); \
touch $(OUT_COMMON)/$(LAST_INIT); \
make GIGA= OPENSOURCE= BUILD=$(BUILD) clean && \
make GIGA= OPENSOURCE= BUILD=$(BUILD) configure; \
fi;
$(call make_for,$@)