forked from osm0sis/mkbootimg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·51 lines (40 loc) · 966 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
# Andrew Huang <bluedrum@163.com>
ifeq ($(CC),cc)
CC = gcc
endif
AR = ar rcv
ifeq ($(windir),)
EXE =
RM = rm -f
else
EXE = .exe
RM = del
endif
CFLAGS = -ffunction-sections -O3
ifneq (,$(findstring darwin,$(CROSS_COMPILE)))
UNAME_S := Darwin
else
UNAME_S := $(shell uname -s)
endif
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -Wl,-dead_strip
else
LDFLAGS += -Wl,--gc-sections -s
endif
all:mkbootimg$(EXE) unpackbootimg$(EXE)
static:
$(MAKE) LDFLAGS="$(LDFLAGS) -static"
libmincrypt.a:
$(MAKE) -C libmincrypt
mkbootimg$(EXE):mkbootimg.o libmincrypt.a
$(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS)
mkbootimg.o:mkbootimg.c
$(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< -I. -Werror
unpackbootimg$(EXE):unpackbootimg.o
$(CROSS_COMPILE)$(CC) -o $@ $^ $(LDFLAGS)
unpackbootimg.o:unpackbootimg.c
$(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< -Werror
clean:
$(RM) mkbootimg unpackbootimg
$(RM) *.a *.~ *.exe *.o
$(MAKE) -C libmincrypt clean