3 # ---------------------------------------------------------------------------
5 # ---------------------------------------------------------------------------
7 MACHINE
:= $(shell $(CC
) -dumpmachine
)
8 ifeq ($(MACHINE
),$(filter x86_64-
%,$(MACHINE
)))
18 CFLAGS
= -march
=$(MARCH
) -mtune
=$(MTUNE
) -Os
-DNDEBUG
-Wall
-flto
-Ideps
/$(MYCPU
)/include
19 LDFLAGS
= -Ldeps
/$(MYCPU
)/lib
-static
-Wl
,--strip-all
-Wl
,--trace
22 ifeq ($(MACHINE
),$(filter %-mingw32
,$(MACHINE
)))
31 LDFLAGS
+= $(XLDFLAGS
)
37 # ---------------------------------------------------------------------------
39 # ---------------------------------------------------------------------------
41 .PHONY
: all keygen sign verify subdirs
clean
43 all: keygen sign verify
45 keygen
: subdirs src
/.magic.h rsrc
46 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o bin
/codesign_keygen
$(SUFFIX
) src
/codesign_keygen.c src
/common.c obj
/version_keygen.o
$(LIBS
)
48 sign
: subdirs src
/.magic.h
49 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o bin
/codesign_sign
$(SUFFIX
) src
/codesign_sign.c src
/common.c obj
/version_sign.o
$(LIBS
)
51 verify
: subdirs src
/.magic.h rsrc
52 $(CC
) $(CFLAGS
) -UEMBED_PUBKEY
$(LDFLAGS
) -o bin
/codesign_verify
$(SUFFIX
) src
/codesign_verify.c src
/common.c obj
/version_verify.o
$(LIBS
)
53 $(CC
) $(CFLAGS
) -DEMBED_PUBKEY
$(LDFLAGS
) -o bin
/codesign_verifz
$(SUFFIX
) src
/codesign_verify.c src
/common.c obj
/version_verify.o
$(LIBS
)
56 str
=$$(tr
-dc
'0-9A-F' < /dev
/urandom | head
-c
26); \
57 printf
'static const unsigned char MAGIC_NMBR[] = { ' > $@
; \
58 for i in
{0.
.12}; do \
59 [ $$i -gt
0 ] && printf
', '; \
60 printf
'0x%s' $${str
:((2*i
)):2}; \
65 ifeq ($(MACHINE
),$(filter %-mingw32
,$(MACHINE
)))
66 windres
-DAPP
="Key Generator ($(MYCPU))" -DNAME
=keygen
-o obj
/version_keygen.o res
/version.rc
67 windres
-DAPP
="Signer ($(MYCPU))" -DNAME
=sign
-o obj
/version_sign.o res
/version.rc
68 windres
-DAPP
="Verifier ($(MYCPU))" -DNAME
=verify
-o obj
/version_verify.o res
/version.rc
70 $(CC
) -o obj
/version_keygen.o
-xc
-c
- < /dev
/null
71 $(CC
) -o obj
/version_sign.o
-xc
-c
- < /dev
/null
72 $(CC
) -o obj
/version_verify.o
-xc
-c
- < /dev
/null
75 subdirs
: deps
/$(MYCPU
)/lib
/libcrypto.a deps
/$(MYCPU
)/lib
/libssl.a