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.

77 lines
1.6 KiB

5 years ago
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=out
.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
5 years ago
CROSSFLAGS = -I. -I$(PATHS) -I$(PATHL) -D_DEFAULT_SOURCE
# CROSSFLAGS = -I. -I$(PATHS) -I$(PATHL) -D_POSIX_C_SOURCE -D_DEFAULT_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