I have developing an application in C for a raspberry pi. Until now I was cross-compiling this application in Eclipse and debugging in a raspberry. Now I have all the code working I want to create a make file to compile it all in my raspberry.
I have 2 folders (src and inc) where I keep all the code.
I have tried something like this:
CC = gcc
LD = gcc
CFLAG = -Wall
PROG_NAME = test
SRC_DIR = ./src
BUILD_DIR = ./build
BIN_DIR = ./bin
SRC_LIST = $(wildcard $(SRC_DIR)/*.c)
OBJ_LIST = $(BUILD_DIR)/$(notdir $(SRC_LIST:.c=.o))
.PHONY: all clean $(PROG_NAME) compile
all: $(PROG_NAME)
compile:
$(CC) -c $(CFLAG) $(SRC_LIST) -o $(OBJ_LIST) -lwiringPi -lpaho-mqtt3c
$(PROG_NAME): compile
$(LD) $(OBJ_LIST) -o $(BIN_DIR)/$@
clean:
rm -f $(BIN_DIR)/$(PROG_NAME) $(BUILD_DIR)/*.o
But after executing "make" in console, I always get an error:
makefile:17: *** missing separator. Alto.
I do not know where the fail is. This is my first makefile.
All .c files have their .h without paths. something like #include "file.h".