This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gmake questions
- From: Jing Luo <Jing at vicom dot com>
- To: "'gdosreis at sophia dot inria dot fr'" <gdosreis at sophia dot inria dot fr>, "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Sat, 8 Feb 2003 14:34:41 -0800
- Subject: gmake questions
Hi all,
I have few questions about GNU make. I am using gmake 3.79.1 on Linux with
kernel version 2.4.7-10.
1. Define macro failed
My makefile looks like then following:
<makefile>
PROG=hello.o
OBJS=main.o fc.o
OBJDIR=../obj
MACRO=-DSIDE(a)=CONCAT(HS_,a)
(OBJDIR)/%.o : %.c
$(CC) $(CCFLAGS) $(MACRO) $< -o $@
OBJPROG = $(addprefix $(OBJDIR)/, $(PROG))
all: $(OBJPROG)
$(OBJPROG): $(addprefix $(OBJDIR)/, $(OBJS))
$(LD) $(LDFLAGS) $^ -o $@
Run [sample]: gmake all
Result:
gcc -DSIDE(a)=CONCAT(DS_,a) -Wall -O2 -g -o fc.o fc.c
/bin/sh: -c: line 1: syntax error near unexpected token `-DSIDE(a'
/bin/sh: -c: line 1: `gcc -DSIDE(a)=CONCAT(DS_,a) -Wall -O2 -g -o fc.o fc.c'
gmake: *** [fc.o] Error 2
2. If I want to make different rules for target .o, can I do it like this?
(OBJDIR)/%.o : %.c
$(CC) $(CCFLAGS) $(MACRO) $< -o $@
(SEC_OBJ)/%.o: %.c
$(CC) $(CCFLAGS) $(MACRO) $< -o $@
Thanks,
Jing