分类: LINUX
2015-07-27 21:55:12
toupper = $(shell echo $1 |tr '[a-z]' '[A-Z]')
tolower = $(shell echo $1 |tr '[A-Z]' '[a-z]')
mkbat = ./makebat
mkbsp = $(mkbat) $(call tolower,$(word 3,$(subst __, ,$@))) all $(call toupper,$(word 1,$(subst __, ,$@))) $(call toupper,$(word 2,$(subst __, ,$@)))
mklcardbsp = $(mkbat) bspver all $(call toupper,$(word 3,$(subst __, ,$@))) $(call toupper,$(word 2,$(subst __, ,$@)))
mklib = $(mkbat) $(call tolower,$(word 2,$(subst __, ,$@))) all $(call toupper,$(word 1,$(subst __, ,$@)))
mkcommon = $(mkbat) process all $(call toupper,$(word 2,$(subst __, ,$@))) $(call toupper,$(word 1,$(subst __, ,$@))) liball
mkproc = $(mkbat) process all $(call toupper,$(word 2,$(subst __, ,$@))) $(call toupper,$(word 1,$(subst __, ,$@))) allproc
mkboard = $(mkbat) board all $(call toupper,$(word 2,$(subst __, ,$@))) $(call toupper,$(word 1,$(subst __, ,$@))) allproc
mkprj = $(mkbat) prj all NCPA $(call toupper,$(word 2,$(subst __, ,$@))) comprj
mkapp = $(mkbat) process all $(call toupper,$(word 2,$(subst __, ,$@))) $(call toupper,$(word 1,$(subst __, ,$@))) app
mkallproc = $(mkbat) process all $(call toupper,$(word 2,$(subst __, ,$@))) $(call toupper,$(word 1,$(subst __, ,$@))) allproc
mklcardadm = $(mkbat) process all COMMON $(call toupper,$(word 1,$(subst __, ,$@))) admlinecard
board_cpu = p2020 armadaxp saber
prj_cpu = 83xx armam335x saber armadaxp
lcard_bsp_83xx = $(addprefix bspver__83xx__,61NPC_8313 OIGE8 RMU)
lcard_bsp_arm = $(addprefix bspver__am335x__,E1E16)
lcard_app = SAI E1t1_Coeus FEGE E1T1 STM_COEUS GPC RMU
lcard_app_saber = $(addprefix saber__,$(wordlist 2,3,$(lcard_app)))
lcard_app_armadaxp = $(addprefix armadaxp__,$(wordlist 1,3,$(lcard_app)))
lcard_app_p2020 = $(addprefix p2020__,$(wordlist 1,3,$(lcard_app)))
lcard_app_armam335x = $(addprefix armam335x__,$(wordlist 1,3,$(lcard_app)))
lcard_app_83xx = $(addprefix 83xx__,$(wordlist 3,7,$(lcard_app)))
all: sme smk smha lcard_app_83xx lcard_app_armam335x
$(lcard_bsp_arm) $(lcard_bsp_83xx):
$(call mklcardbsp)
p2020__bspver:sme__p2020__bspver
armadaxp__bspver:smk__armadaxp__bspver
saber__bspver:smha__saber__bspver
%__bspver:
$(call mkbsp)
%__tuliplib:%__bspver
$(call mklib)
%__dbscore:%__tuliplib
$(call mklib)
%__COMMON:%__dbscore
$(call mkcommon)
%__NCPA:%__dbscore
$(call mkcommon)
%__COMMON__proc:%__COMMON
$(call mkproc)
%__NCPA__proc:%__NCPA
$(call mkproc)
%__COMMON__board:%__COMMON
$(call mkboard)
%__NCPA__board:%__NCPA
$(call mkboard)
83xx__tuliplib:$(lcard_bsp_83xx)
$(call mklib)
armam335x__tuliplib:$(lcard_bsp_arm)
$(call mklib)
$(prj_cpu):%:prj__%
prj__%:%__tuliplib
$(call mkprj)
$(lcard_app_p2020):p2020__dbscore
$(call mkapp)
$(lcard_app_armadaxp):armadaxp__dbscore
$(call mkapp)
$(lcard_app_saber):saber__dbscore
$(call mkapp)
$(lcard_app_armam335x):armam335x__adm
$(call mkallproc)
armam335x__adm:prj__armam335x
$(call mklcardadm)
$(lcard_app_83xx):83xx__adm
$(call mkallproc)
83xx__adm:prj__83xx
$(call mklcardadm)
lcard_app_p2020:$(lcard_app_p2020)
lcard_app_armadaxp:$(lcard_app_armadaxp)
lcard_app_saber:$(lcard_app_saber)
lcard_app_83xx:$(lcard_app_83xx)
lcard_app_armam335x:$(lcard_app_armam335x)
$(board_cpu):%: %__COMMON__board %__NCPA__board lcard_app_%
sme: p2020
smk: armadaxp
smha: saber