Some improvements to Linux build scripts.

This commit is contained in:
LoRd_MuldeR 2022-06-27 20:57:55 +02:00
parent 27461a5d0d
commit 391621d601
2 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ SHELL := bash
# FLAGS
# ---------------------------------------------------------------------------
MACHINE := $(shell gcc -dumpmachine)
MACHINE := $(shell $(CC) -dumpmachine)
ifeq ($(MACHINE),$(filter x86_64-%,$(MACHINE)))
MYCPU := x64
MARCH := x86-64
@ -43,14 +43,14 @@ endif
all: keygen sign verify
keygen: subdirs src/.magic.h rsrc
gcc $(CFLAGS) $(LDFLAGS) -o bin/codesign_keygen$(SUFFIX) src/codesign_keygen.c src/common.c obj/version_keygen.o $(LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/codesign_keygen$(SUFFIX) src/codesign_keygen.c src/common.c obj/version_keygen.o $(LIBS)
sign: subdirs src/.magic.h
gcc $(CFLAGS) $(LDFLAGS) -o bin/codesign_sign$(SUFFIX) src/codesign_sign.c src/common.c obj/version_sign.o $(LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/codesign_sign$(SUFFIX) src/codesign_sign.c src/common.c obj/version_sign.o $(LIBS)
verify: subdirs src/.magic.h rsrc
gcc $(CFLAGS) -UEMBED_PUBKEY $(LDFLAGS) -o bin/codesign_verify$(SUFFIX) src/codesign_verify.c src/common.c obj/version_verify.o $(LIBS)
gcc $(CFLAGS) -DEMBED_PUBKEY $(LDFLAGS) -o bin/codesign_verifz$(SUFFIX) src/codesign_verify.c src/common.c obj/version_verify.o $(LIBS)
$(CC) $(CFLAGS) -UEMBED_PUBKEY $(LDFLAGS) -o bin/codesign_verify$(SUFFIX) src/codesign_verify.c src/common.c obj/version_verify.o $(LIBS)
$(CC) $(CFLAGS) -DEMBED_PUBKEY $(LDFLAGS) -o bin/codesign_verifz$(SUFFIX) src/codesign_verify.c src/common.c obj/version_verify.o $(LIBS)
src/.magic.h:
str=$$(tr -dc '0-9A-F' < /dev/urandom | head -c 26); \
@ -67,9 +67,9 @@ ifeq ($(MACHINE),$(filter %-mingw32,$(MACHINE)))
windres -DAPP="Signer ($(MYCPU))" -DNAME=sign -o obj/version_sign.o res/version.rc
windres -DAPP="Verifier ($(MYCPU))" -DNAME=verify -o obj/version_verify.o res/version.rc
else
gcc -o obj/version_keygen.o -xc -c - < /dev/null
gcc -o obj/version_sign.o -xc -c - < /dev/null
gcc -o obj/version_verify.o -xc -c - < /dev/null
$(CC) -o obj/version_keygen.o -xc -c - < /dev/null
$(CC) -o obj/version_sign.o -xc -c - < /dev/null
$(CC) -o obj/version_verify.o -xc -c - < /dev/null
endif
subdirs: deps/$(MYCPU)/lib/libcrypto.a deps/$(MYCPU)/lib/libssl.a

View File

@ -6,7 +6,7 @@ trap 'read -p "Press any key..." x' EXIT
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up compiler
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "$(cc -dumpmachine)" in
case "$(${CC:-cc} -dumpmachine)" in
i686-*)
readonly MY_CPU=x86
readonly MY_MARCH=i486