This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]