Makefile error - include error - C programming

196 views Asked by At

I am running into an error when building my Makefile. It can't see to locate the header files in the root/include directory. This is my file structure:

root:
---->include
     ---->CMSIS:
               header files
     ---->common:
               header files
     ---->MSP432:
               heaader files

---->src:
     Makefile
     C files
     Sources.mk

---->linker file

I have included -I$(INCLUDES) in the TARGET.out instruction. This is my Makefile:

#******************************************************************************
# Copyright (C) 2017 by Alex Fosdick - University of Colorado
#
# Redistribution, modification or use of this software in source or binary
# forms is permitted as long as the files maintain this copyright. Users are 
# permitted to modify this and use it to learn about the field of embedded
# software. Alex Fosdick and the University of Colorado are not liable for any
# misuse of this material. 
#
#*****************************************************************************

#------------------------------------------------------------------------------
# <Put a Description Here>
#
# Use: make [TARGET] [PLATFORM-OVERRIDES]
#
# Build Targets:
#      
#
# Platform Overrides:
#
#------------------------------------------------------------------------------
include sources.mk

# Platform Overrides
PLATFORM = MSP432

# Architectures Specific Flags
LINKER_FILE = ../msp432p401r.lds
CPU = cortex-m4
ARCH = armv7e-m
FLOAT = hard
FPU = fpv4-sp-d16
SPECS = nosys.specs
TARGET = c1m2

# Compiler Flags and Defines
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld
LDFLAGS = -Wl, -Map=$(TARGET).map -T $(LINKER_FILE)
CFLAGS = -mcpu=$(CPU) -mthumb -march=$(ARCH) -mfloat-abi=$(FLOAT) -mfpu=$(FPU) --specs=$(SPECS) -Wall -c -Werror -g -O0 -std=c99
CPPFLAGs = -MD -MP

OBJS = $(SOURCES:.c=.o)

%.o : %.c 
   $(CC) -I$(INCLUDES) $< $(CFLAGS) -o $@

.PHONY: build
build: all

.PHONY: all
all: $(TARGET).out

$(TARGET).out: $(OBJS)
   $(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $@

.PHONY: clean
clean:
   rm -f $(OBJS) $(TARGET).out $(TARGET).map

This is my Sources.mk. I tried removing the *.h but I receive the same error:

# Add your Source files to this variable
SOURCES = interrupts_msp432p401r_gcc.c \
          main.c \
          memory.c \
          startup_msp432p401r_gcc.c \
          system_msp432p401r.c

# Add your include paths to this variable
INCLUDES = ../include/CMSIS \
           ../include/common \
           ../include/msp432

Output error:

arm-none-eabi-gcc main.c -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nosys.specs -Wall -c -Werror -g -O0 -std=c99 -o main.o
main.c:23:22: fatal error: platform.h: No such file or directory
compilation terminated.
Makefile:47: recipe for target 'main.o' failed
make: *** [main.o] Error 1```
0

There are 0 answers