forked from arkku/ihex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.arm
39 lines (28 loc) · 845 Bytes
/
Makefile.arm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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