mirror of
https://github.com/VARCem/ihex.git
synced 2026-07-08 18:16:02 +00:00
40 lines
845 B
Makefile
40 lines
845 B
Makefile
CROSS=arm-none-eabi-
|
|
CC=$(CROSS)gcc
|
|
CFLAGS=-Wall -std=c99 -pedantic -Wextra -Wno-unknown-pragmas -Os -mlittle-endian -mthumb -fsingle-precision-constant -ffunction-sections -fdata-sections
|
|
LDFLAGS=-Wl,--gc-sections
|
|
AR=$(CROSS)ar
|
|
ARFLAGS=rcs
|
|
|
|
ARM_FLAGS=-DIHEX_DISABLE_SEGMENTS -DIHEX_LINE_MAX_LENGTH=32
|
|
|
|
OBJPATH = ./arm/
|
|
OBJS = $(OBJPATH)kk_ihex_write.o $(OBJPATH)kk_ihex_read.o
|
|
LIBPATH = ./arm/
|
|
LIB = $(LIBPATH)libkk_ihex.a
|
|
|
|
.PHONY: all clean distclean test
|
|
|
|
all: $(LIB)
|
|
|
|
$(OBJS): kk_ihex.h
|
|
$(OBJS): | $(OBJPATH)
|
|
$(LIB): | $(LIBPATH)
|
|
|
|
$(LIB): $(OBJS)
|
|
$(AR) $(ARFLAGS) $@ $+
|
|
|
|
$(OBJPATH)%.o: %.c %.h
|
|
$(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@
|
|
|
|
$(sort $(LIBPATH) $(OBJPATH)):
|
|
@mkdir -p $@
|
|
|
|
clean:
|
|
rm -f $(OBJS)
|
|
@rmdir $(OBJPATH) >/dev/null 2>/dev/null || true
|
|
|
|
distclean: | clean
|
|
rm -f $(LIB)
|
|
@rmdir $(LIBPATH) >/dev/null 2>/dev/null || true
|
|
|