forked from uboborov/EFM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (40 loc) · 896 Bytes
/
Makefile
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
ARCH ?= x86
OS_LINUX = yes
ifeq ($(ARCH),arm)
DEFS=-DARCH_ARM
else
DEFS=-DARCH_I386
endif
CC ?= gcc
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
CPFLAGS = $(MAKEFLAGS) $(DEFS) -g -O2 -Wall -m32
LDFLAGS = $(MAKEFLAGS) -g -O2 -m32
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)
%.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)