-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (61 loc) · 1.65 KB
/
Makefile
File metadata and controls
83 lines (61 loc) · 1.65 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
APPBIN_PATH ?= ~/
LIBGCC_PATH = /usr/local/angstrom/armv7linaro/lib/gcc/arm-linux-gnueabihf/4.7.3
LIBC_PATH = /usr/local/angstrom/armv7linaro/lib
ARCH ?= arm
OS_LINUX = yes
ifeq ($(ARCH),arm)
PATH=$PATH:/usr/local/angstrom/armv7linaro/bin/
CROSS_COMPILE = arm-linux-gnueabihf-
DEFS=-DARCH_ARM
else
CROSS_COMPILE:=
DEFS=-DARCH_I386
endif
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OCP = $(CROSS_COMPILE)objcopy
AS = $(CROSS_COMPILE)gcc -x assembler-with-cpp
AR = $(CROSS_COMPILE)ar
CP = /usr/bin/sudo /bin/cp
MKFILE = Makefile
SRC = dav.c EFM.c efm_c.c cport.c
ifeq ($(OS_LINUX),yes)
DEFS += -DOS_LINUX
SRC += term.c
endif
ifeq ($(ARCH),arm)
CPFLAGS = $(MCFLAGS) $(DEFS) -mlittle-endian -mfloat-abi=hard -O2 -Wall -Wno-pointer-sign
else
CPFLAGS = $(MCFLAGS) $(DEFS) -g -O2 -Wall -m32
endif
CPFLAGS += -fno-strict-aliasing -lpthread -Ulinux -Dlinux=linux -I. -I/usr/local/include
LIBDIR = -L$(LIBGCC_PATH) -L$(LIBC_PATH)
ifeq ($(ARCH),arm)
LDFLAGS = $(MCFLAGS) -g -O2 -Wl,-EL -lm -lc -lgcc -lrt -lpthread $(LIBDIR)
else
LDFLAGS = $(MCFLAGS) -g -O2 -lm -lrt -m32 -lpthread
endif
OBJS = $(SRC:.c=.o)
DEPS = $(SRC:.c=.d)
DEL = /bin/rm -f
.PHONY: all target
target: all
all: $(OBJS) $(MAKEFILE)
$(CC) $(OBJS) -o efm $(LDFLAGS)
# -$(CP) efm $(APPBIN_PATH)
%.d: %.c $(MKFILE)
@echo "Building dependencies for '$<'"
$(CC) -E -MM -MQ $(<:.c=.o) $(CPFLAGS) $< -o $@
$(DEL) $(<:.c=.o)
%.o: %.c $(MKFILE)
@echo "Compiling '$<'"
$(CC) -c $(CPFLAGS) -I . $< -o $@
clean:
-$(DEL) $(OBJS:/=\)
-$(DEL) $(DEPS:/=\)
.PHONY: dep
dep: $(DEPS) $(SRC)
@echo "##########################"
@echo "### Dependencies built ###"
@echo "##########################"
-include $(DEPS)