Original Post
Hi! I''ve got a generic makefile with a list of dependencies and a single inference rule to make .c files into .o files. Heres the makefile ("..." means that there is more there, but it''s not important to my question):
...
CC_ARM = gcc -marm -mthumb-interwork
CC_THUMB = gcc -mthumb -mthumb-interwork
CFILES_ARM = Irq.c \
CFILES_THUMB = Debug.c \
Dma.c \
Input.c \
Level.c \
Main.c \
Math.c \
Render.c \
Sprite.c \
Timer.c \
Video.c \
OBJS = $(CFILES_ARM:.c=.o) \
$(CFILES_THUMB:.c=.o) \
CFLAGS = -c -Wall
...
##############################################################
## RULES ##############################################################
...
%.o : %.c
@ECHO Compiling ARM file $<...
@$(CC_THUMB) $(CFLAGS) $< -o $@
...
##############################################################
## DEPENDENCIES ##############################################################
include C:\Game\Code\Dependencies\Debug.dpn
include C:\Game\Code\Dependencies\Input.dpn
include C:\Game\Code\Dependencies\Main.dpn
include C:\Game\Code\Dependencies\Video.dpn
include C:\Game\Code\Dependencies\Timer.dpn
include C:\Game\Code\Dependencies\Dma.dpn
include C:\Game\Code\Dependencies\Level.dpn
include C:\Game\Code\Dependencies\Math.dpn
include C:\Game\Code\Dependencies\Sprite.dpn
include C:\Game\Code\Dependencies\Irq.dpn
The .dpn files contain the dependencies for the .o files. My question is this: is there a way to make 2 inference rules to have some of the .c files compiled using the CC_THUMB compiler and others to use the CC_ARM compiler? For example say I need to compile irq.c using CC_ARM, and everything else using CC_THUMB...how would I go about doing this in my makefile? This is a problem becuase all the object files need to be .o (ie, I can''t have an inference rule for .o_thumb files and one fore .o_arm files). Maybe there is a way to do an if statement in a makefile? By the way, i''m using a gnu compiler (gcc). Any help would be great. Thanks!