Reputation: 569
I am trying to build a new makefile but I encountered an error, the code for the same makefile is below:
ifeq($(ARCH),bbb)
$(CC)=arm-linux-gnueabi-gcc
else ifeq($(ARCH),frdm)
$(CC)=arm-none-eabi-gcc
else
$(CC)=gcc
endif
CFLAGS=-c
CFLAG=-o
all:memory.o data.o proj_1.o main.o
$(CC) memory.o data.o proj_1.o main.o $(CFLAG) main
main.o: main.c
$(CC) main.c $(CFLAGS)
memory.o: memory.c
$(CC) memory.c $(CFLAGS)
data.o:data.c
$(CC) data.c $(CFLAGS)
proj_1.o:proj_1.c
$(CC) proj_1.c $(CFLAGS)
clean:
rm -rf *o
The error message is
test.mk:1: *** missing separator. Stop.
Can someone point out what I am doing incorrectly?
Thanks
Upvotes: 0
Views: 249
Reputation: 21000
You need a space between ifeq and (
/ '
/ "
.
Your entire makefile can be simplified to the following, make already knows how to do most of what you've written.
ifeq ($(ARCH),bbb)
prefix := arm-linux-gnueabi-
else ifeq ($(ARCH),frdm)
prefix := arm-none-eabi-
endif
CC := $(prefix)$(CC)
objects := memory.o data.o proj_1.o main.o
main: $(objects)
clean: ; $(RM) $(objects) main
Upvotes: 1