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) 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]))