From e273de464af7b19d4d8d4edb8bb469071a85e0e9 Mon Sep 17 00:00:00 2001 From: Gerard Swiderski Date: Wed, 12 Jul 2023 13:58:07 +0200 Subject: [PATCH 1/2] makes: add uppercase and lowercase shortcuts JIRA: RTOS-519 --- makes/funcs.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/makes/funcs.mk b/makes/funcs.mk index b92513b5..3e3cf97e 100644 --- a/makes/funcs.mk +++ b/makes/funcs.mk @@ -1,5 +1,10 @@ ### simple utility/shortcut functions ### +# Converts to upper case +uppercase = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) + +# Converts to lower case +lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) # quick template for adding tests (makes xxx binary from xxx.c with optional libs/dependencies) # $(eval $(call add_test, NAME [, LIBS][, DEP_LIBS])) From 090220ed42559e2d29d53c94660d7880a4845ee8 Mon Sep 17 00:00:00 2001 From: Gerard Swiderski Date: Wed, 12 Jul 2023 13:58:46 +0200 Subject: [PATCH 2/2] makes: add global defines __TARGET and __CPU Adds globally visible defines pointing to TARGET architecture and CPU. The definitions are derived from TARGET_FAMILY and TARGET_SUBFAMILY. JIRA: RTOS-519 --- Makefile.common | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile.common b/Makefile.common index 01869545..e530f5f3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -81,6 +81,13 @@ $(info cleaning targets, make parallelism disabled) .NOTPARALLEL: endif +# Distribute the __TARGET and __CPU defines +CFLAGS += -D__TARGET_$(call uppercase,$(TARGET_FAMILY)) +CXXFLAGS += -D__TARGET_$(call uppercase,$(TARGET_FAMILY)) + +CFLAGS += -D__CPU_$(call uppercase,$(TARGET_SUBFAMILY)) +CXXFLAGS += -D__CPU_$(call uppercase,$(TARGET_SUBFAMILY)) + # generic CFLAGS/LDFLAGS LDFLAGS += -L$(PREFIX_A)