forked from CyanogenMod/android_system_core
-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Makefile
55 lines (43 loc) · 997 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
54
ifeq ($(CC),cc)
CC = gcc
endif
AR = ar rc
ifeq ($(windir),)
EXT =
RM = rm -f
CP = cp
else
EXT = .exe
RM = del
CP = copy /y
endif
CFLAGS += -ffunction-sections -O3
INC = -I.
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$(EXT) unpackbootimg$(EXT)
static:
$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS) -static"
libmincrypt.a:
$(MAKE) CFLAGS="$(CFLAGS)" -C libmincrypt
mkbootimg$(EXT):mkbootimg.o libmincrypt.a
$(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS)
unpackbootimg$(EXT):unpackbootimg.o
$(CROSS_COMPILE)$(CC) -o $@ $^ $(LDFLAGS)
%.o:%.c
$(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< $(INC) -Werror
install:
install -m 755 mkbootimg$(EXT) $(PREFIX)/bin
install -m 755 unpackbootimg$(EXT) $(PREFIX)/bin
clean:
$(RM) mkbootimg unpackbootimg
$(RM) *.a *.~ *.exe *.o
$(MAKE) -C libmincrypt clean