forked from anpaza/make_ext4fs
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
83 lines (72 loc) · 1.53 KB
/
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
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
# Build configuration
STATIC = 0
DEBUG = 0
DIET = 0
TARGET = windows
CC = $(PREFIX)gcc -c
CFLAGS = -DUSE_MMAP -DHOST -DANDROID
LD = $(PREFIX)gcc
LDFLAGS =
LIBS =
AR = $(PREFIX)ar
ARFLAGS = rcs
ifeq ($(ARCH),)
ARCH = `uname -m`
endif
DEPLOY = deploy/$(ARCH)/
ifeq ($(DEBUG),1)
CFLAGS += -g
LDFLAGS += -g
DEPLOY := $(DEPLOY)debug-
else
CFLAGS += -DNDEBUG -O2
LDFLAGS += -s
DEPLOY := $(DEPLOY)release-
endif
ifeq ($(DIET),1)
PREFIX += diet #
DEPLOY := $(DEPLOY)diet-
ifeq ($(STATIC),1)
# DIET builds are always static, but -static will produce wrong results
STATIC := 0
endif
endif
ifeq ($(STATIC),1)
LDFLAGS += -static
DEPLOY := $(DEPLOY)static-
endif
# run make TARGET=windows for a mingw32 build
ifeq ($(TARGET),windows)
PREFIX += x86_64-w64-mingw32-
CFLAGS += -DUSE_MINGW
LIBS += -lwsock32
E = .exe
DEPLOY := $(DEPLOY)windows
else
DEPLOY := $(DEPLOY)linux
endif
SELIB = libselinux
ZLLIB = zlib/src
SPLIB = core/libsparse
COLIB = core
MALIB = extras/ext4_utils
MFLAGS += CC="$(CC)" CFLAGS="$(CFLAGS)" \
LD="$(LD)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
AR="$(AR)" ARFLAGS="$(ARFLAGS)" \
E="$E"
all:
$(MAKE) $(MFLAGS) -C $(SELIB)/src all
$(MAKE) $(MFLAGS) -C $(ZLLIB) all
$(MAKE) $(MFLAGS) -C $(SPLIB) all
$(MAKE) $(MFLAGS) -C $(MALIB) all
clean:
$(MAKE) $(MFLAGS) -C $(SELIB)/src clean
$(MAKE) $(MFLAGS) -C $(ZLLIB) clean
$(MAKE) $(MFLAGS) -C $(SPLIB) clean
$(MAKE) $(MFLAGS) -C $(MALIB) clean
deploy: all
mkdir -p $(DEPLOY)
cp ./extras/ext4_utils/make_ext4fs$E \
./core/libsparse/simg2img$E \
./core/libsparse/img2simg$E \
$(DEPLOY)