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>2022-11-09 23:15:06 +0300
committerosm0sis <osm0sis@outlook.com>2022-11-09 23:23:44 +0300
commit2375c167cbcb10d1ea2c357b7f0a90625462f9be (patch)
tree950b25a2e1ae37f99b835686913f21c533ec388d
parent9db52f777659ebdc728ed3a34e3e35bbe52dd4ad (diff)
Makefiles: updates/fixesHEAD2022.11.09master
- allow additional CFLAGS while fixing recursion for static recipe - update boilerplate
-rw-r--r--Makefile42
-rwxr-xr-xlibmincrypt/Makefile21
2 files changed, 33 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 6ee3a38c..2818d064 100644
--- a/Makefile
+++ b/Makefile
@@ -1,52 +1,52 @@
-# Andrew Huang <bluedrum@163.com>
ifeq ($(CC),cc)
CC = gcc
endif
-AR = ar rcv
+AR = ar rc
ifeq ($(windir),)
-EXE =
+EXT =
RM = rm -f
+CP = cp
else
-EXE = .exe
+EXT = .exe
RM = del
+CP = copy /y
endif
-CFLAGS = -ffunction-sections -O3
+CFLAGS += -ffunction-sections -O3
+
+INC = -I.
ifneq (,$(findstring darwin,$(CROSS_COMPILE)))
- UNAME_S := Darwin
+ UNAME_S := Darwin
else
- UNAME_S := $(shell uname -s)
+ UNAME_S := $(shell uname -s)
endif
ifeq ($(UNAME_S),Darwin)
- LDFLAGS += -Wl,-dead_strip
+ LDFLAGS += -Wl,-dead_strip
else
- LDFLAGS += -Wl,--gc-sections -s
+ LDFLAGS += -Wl,--gc-sections -s
endif
-all:mkbootimg$(EXE) unpackbootimg$(EXE)
+all:mkbootimg$(EXT) unpackbootimg$(EXT)
static:
- $(MAKE) LDFLAGS="$(LDFLAGS) -static"
+ $(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS) -static"
libmincrypt.a:
- $(MAKE) -C libmincrypt
+ $(MAKE) CFLAGS="$(CFLAGS)" -C libmincrypt
-mkbootimg$(EXE):mkbootimg.o libmincrypt.a
+mkbootimg$(EXT):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
+unpackbootimg$(EXT):unpackbootimg.o
$(CROSS_COMPILE)$(CC) -o $@ $^ $(LDFLAGS)
-unpackbootimg.o:unpackbootimg.c
- $(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< -Werror
+%.o:%.c
+ $(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< $(INC) -Werror
install:
- install -m 755 unpackbootimg $(PREFIX)/bin
- install -m 755 mkbootimg $(PREFIX)/bin
+ install -m 755 mkbootimg$(EXT) $(PREFIX)/bin
+ install -m 755 unpackbootimg$(EXT) $(PREFIX)/bin
clean:
$(RM) mkbootimg unpackbootimg
diff --git a/libmincrypt/Makefile b/libmincrypt/Makefile
index ad482de9..3ef33026 100755
--- a/libmincrypt/Makefile
+++ b/libmincrypt/Makefile
@@ -3,29 +3,32 @@ 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
-EXT = a
-LIB = libmincrypt.$(EXT)
+CFLAGS += -ffunction-sections -O3
+
+INC = -I..
+
+EXT = .a
+LIB = libmincrypt$(EXT)
LIB_OBJS = dsa_sig.o p256.o p256_ec.o p256_ecdsa.o rsa.o sha.o sha256.o
-INC = -I..
all:$(LIB)
-clean:
- $(RM) $(LIB_OBJS) $(LIB)
-
$(LIB):$(LIB_OBJS)
$(CROSS_COMPILE)$(AR) $@ $^
$(CP) $@ ..
-
%.o:%.c
- $(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< $(INC)
+ $(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< $(INC) -Werror
+
+clean:
+ $(RM) $(LIB_OBJS) $(LIB)