Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/osm0sis/mkbootimg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorosm0sis <osm0sis@outlook.com>2017-12-13 11:35:23 +0300
committerosm0sis <osm0sis@outlook.com>2017-12-13 11:35:48 +0300
commit484fa304671bb9244113254e752870144b9f14e7 (patch)
treeabe799fb9fbea15050148e490b31d6be7431bc7e
parent8f1843e85db82d4990fecb4ec20aa2ad55ed5dbd (diff)
Makefile: allow cross-compile to Darwin (macOS), cleanups
-rwxr-xr-xMakefile27
-rwxr-xr-xlibmincrypt/Makefile2
2 files changed, 16 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 52889d7a..ff098bb5 100755
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
# Andrew Huang <bluedrum@163.com>
+ifeq ($(CC),cc)
CC = gcc
+endif
AR = ar rcv
ifeq ($(windir),)
EXE =
@@ -11,40 +13,39 @@ endif
CFLAGS = -ffunction-sections -O3
-UNAME_S := $(shell uname -s)
+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
+ LDFLAGS += -Wl,--gc-sections -s
endif
all:libmincrypt.a mkbootimg$(EXE) unpackbootimg$(EXE)
-static:libmincrypt.a mkbootimg-static$(EXE) unpackbootimg-static$(EXE)
+static:
+ make LDFLAGS="$(LDGLAGS) -static"
libmincrypt.a:
make -C libmincrypt
mkbootimg$(EXE):mkbootimg.o
- $(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS) -s
-
-mkbootimg-static$(EXE):mkbootimg.o
- $(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS) -static -s
+ $(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) -s
-
-unpackbootimg-static$(EXE):unpackbootimg.o
- $(CROSS_COMPILE)$(CC) -o $@ $^ $(LDFLAGS) -static -s
+ $(CROSS_COMPILE)$(CC) -o $@ $^ $(LDFLAGS)
unpackbootimg.o:unpackbootimg.c
$(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< -Werror
clean:
- $(RM) mkbootimg mkbootimg-static mkbootimg.o unpackbootimg unpackbootimg-static unpackbootimg.o mkbootimg.exe mkbootimg-static.exe unpackbootimg.exe unpackbootimg-static.exe
- $(RM) libmincrypt.a Makefile.~
+ $(RM) mkbootimg unpackbootimg
+ $(RM) *.a *.~ *.exe *.o
make -C libmincrypt clean
diff --git a/libmincrypt/Makefile b/libmincrypt/Makefile
index a5fd66b3..ad482de9 100755
--- a/libmincrypt/Makefile
+++ b/libmincrypt/Makefile
@@ -1,4 +1,6 @@
+ifeq ($(CC),cc)
CC = gcc
+endif
AR = ar rc
ifeq ($(windir),)
RM = rm -f