Final assignment for the course "Real Time and Embedded Systems" of THMMY in AUTH university.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.8 KiB

ifeq ($(OS),Windows_NT)
ifeq ($(shell uname -s),) # not in a bash-like shell
CLEANUP = del /F /Q
MKDIR = mkdir
else # in a bash-like shell, like msys
CLEANUP = rm -f
MKDIR = mkdir -p
endif
TARGET_EXTENSION=.exe
else
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=out
endif
.PHONY: cleandep
.PHONY: clean
PATHS = src/
PATHL = lib/
PATHB = build/
PATHD = build/depends/
PATHO = build/objs/
BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHL)
CROSSCOMPILE = arm-linux-gnueabihf-gcc -c
CROSSLINK = arm-linux-gnueabihf-gcc
DEPEND = gcc -MM -MG -MF
CROSSFLAGS = -I. -I$(PATHS) -I$(PATHL) -D_POSIX_C_SOURCE
CROSSFLAGS += -std=c99
CROSSFLAGS += -march=armv6
CROSSFLAGS += -mfloat-abi=hard
CROSSFLAGS += -mfpu=vfp
CROSSFLAGS += -Wall
CROSSFLAGS += -Wextra
CROSSFLAGS += -Wpointer-arith
CROSSFLAGS += -Wcast-align
# CROSSFLAGS += -Wwrite-strings
CROSSFLAGS += -Wswitch-default
CROSSFLAGS += -Wunreachable-code
CROSSFLAGS += -Winit-self
CROSSFLAGS += -Wmissing-field-initializers
CROSSFLAGS += -Wno-unknown-pragmas
CROSSFLAGS += -Wstrict-prototypes
CROSSFLAGS += -Wundef
CROSSFLAGS += -Wold-style-definition
RELEASE = $(PATHB)zaqar.$(TARGET_EXTENSION)
RELEASEDEPS = $(patsubst $(PATHL)%.c,$(PATHO)%.o, $(wildcard $(PATHL)*.c))
release: $(RELEASEDEPS) $(RELEASE)
$(PATHB)zaqar.$(TARGET_EXTENSION):: $(PATHO)zaqar.o $(RELEASEDEPS)
$(CROSSLINK) -o $@ $^
$(PATHO)zaqar.o:: $(PATHS)zaqar.c
$(CROSSCOMPILE) $(CROSSFLAGS) $< -o $@
$(PATHO)%.o:: $(PATHL)%.c
$(CROSSCOMPILE) $(CROSSFLAGS) $< -o $@
$(PATHD)%.d:: $(PATHT)%.c
$(DEPEND) $@ $<
$(PATHB):
$(MKDIR) $(PATHB)
$(PATHD):
$(MKDIR) $(PATHD)
$(PATHO):
$(MKDIR) $(PATHO)
clean:
$(CLEANUP) $(PATHO)*.o
$(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION)
$(CLEANUP) $(PATHTR)*.c
cleandep:
$(CLEANUP) $(PATHD)*.d
.PRECIOUS: $(PATHD)%.d
.PRECIOUS: $(PATHO)%.o