Enable optimization for size by default
[oweals/u-boot_mod.git] / Makefile
index c91b21990559c46626de73b6ffd8d1b2adf20bab..d2a0db1342e131a58c6c3e69e45917e80eff5ee6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,15 @@ ifndef CROSS_COMPILE
 endif
 export CROSS_COMPILE
 
+# By default, optimization for size (-Os) is enabled, set below option
+# to n or remove it if you want only basic optimization (-O/-O1)
+# BUILD_OPTIMIZED = n
+
+ifneq ($(BUILD_OPTIMIZED), n)
+  BUILD_OPTIMIZED = y
+endif
+export BUILD_OPTIMIZED
+
 # ==========================================================================
 
 # =======================
@@ -89,9 +98,21 @@ $(if $(IMG_LZMA),\
 )
 endef
 
+define git_branch
+$(shell git symbolic-ref --short -q HEAD 2>/dev/null || echo "unknown")
+endef
+
+define git_hash
+$(shell git rev-parse --short=8 -q HEAD 2>/dev/null || echo "unknown")
+endef
+
+define git_branch_hash
+git_$(call git_branch)-$(call git_hash)
+endef
+
 # $(1): file extension
 define img_name
-u-boot_mod__$(shell date +"%Y%m%d")__$@$(if \
+u-boot_mod__$@__$(shell date +"%Y%m%d")__$(call git_branch_hash)$(if \
 $(filter $(IMG_RAM),1),__RAM-LOAD-ONLY)$(if $(1),.$(1))
 endef
 
@@ -205,9 +226,11 @@ $(COMMON_AR933X_TARGETS):
 COMMON_ETHS27_TARGETS = \
        tp-link_tl-mr3420_v2 \
        tp-link_tl-wa801nd_v2 \
+       tp-link_tl-wa850re_v2 \
        tp-link_tl-wa830re_v2 \
        tp-link_tl-wdr3500 \
        tp-link_tl-wr802n \
+       tp-link_tl-wr810n \
        tp-link_tl-wr820n_CN \
        tp-link_tl-wr841n_v10 \
        tp-link_tl-wr841n_v11 \
@@ -217,7 +240,9 @@ COMMON_ETHS27_TARGETS = \
 $(COMMON_ETHS27_TARGETS):
        @$(call build,123,1,ETH_CONFIG=_s27)
 
-8devices_carambola2:
+8devices_carambola2 \
+alfa-network_hornet-ub \
+gl-innovations_gl-ar150:
        @$(call build,256,1)
 
 comfast_cf-e314n \
@@ -232,6 +257,13 @@ d-link_dir-505:
 dragino_v2_ms14:
        @$(call build,192,1,DEVICE_VENDOR=dragino)
 
+p2w_cpe505n \
+p2w_r602n \
+yuncore_ap90q \
+yuncore_cpe830 \
+zbtlink_zbt-we1526:
+       @$(call build,256,1,ETH_CONFIG=_s27)
+
 tp-link_tl-wdr3600 \
 tp-link_tl-wdr43x0:
        @$(call build,123,1,ETH_CONFIG=_s17)
@@ -245,11 +277,8 @@ village-telco_mesh-potato_v2:
 wallys_dr531:
        @$(call build,192,1,ETH_CONFIG=_s27)
 
-yuncore_ap90q:
-       @$(call build,256,1,ETH_CONFIG=_s27)
-
-zbtlink_zbt-we1526:
-       @$(call build,256,1,ETH_CONFIG=_s27)
+yuncore_cpe870:
+       @$(call build,64,1,ETH_CONFIG=_s27)
 
 # =============
 # CLEAN TARGETS