gmake questions
Jing Luo
Jing@vicom.com
Sat Feb 8 22:30:00 GMT 2003
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
More information about the Gcc
mailing list