mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
nwztools/upgtools: add support for windows
In order to avoid the crypto++ mess, the code uses the Windows Cryptography API, which is standard. There is also some makefile magic to cross-compile: make PREFIX=i686-w64-mingw32- EXE_EXT=.exe I selected the option so that it should statically link supports libraries used by gcc (slsj and libwinpthread). Change-Id: Iaf07da23afe81ed217fb3921ce13367c5441514d
This commit is contained in:
parent
05fa8fc343
commit
1f338f7078
9 changed files with 239 additions and 90 deletions
|
|
@ -1,26 +1,39 @@
|
|||
DEFINES=
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
LD=g++
|
||||
PROFILE=
|
||||
PKGCONFIG := $(CROSS)pkg-config
|
||||
PREFIX?=
|
||||
EXE_EXT?=
|
||||
CC=$(PREFIX)gcc
|
||||
CXX=$(PREFIX)g++
|
||||
LD=$(PREFIX)g++
|
||||
PKGCONFIG:=$(CROSS)pkg-config
|
||||
|
||||
TARGET_TRIPLE:=$(shell $(CC) -dumpmachine)
|
||||
ifneq ($(findstring -w64-,$(TARGET_TRIPLE)),)
|
||||
TARGET_OS := Windows
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_OS), Windows)
|
||||
# -static allows to statically include libwinpthread-1.dll if possible
|
||||
CFLAGS+=-gstabs
|
||||
CXXFLAGS+=-gstabs
|
||||
LDFLAGS+=-static-libgcc -static
|
||||
else
|
||||
# Distros could use different names for the crypto library. We try a list
|
||||
# of candidate names, only one of them should be the valid one.
|
||||
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
|
||||
|
||||
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||
$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
||||
$(eval LDLIBS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
|
||||
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||
$(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||
$(foreach l,$(LIBCRYPTO_NAMES),\
|
||||
$(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
|
||||
endif
|
||||
|
||||
CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES)
|
||||
CFLAGS=-g $(PROFILE) -Wall -std=c99 $(DEFINES)
|
||||
LDFLAGS=$(PROFILE) $(LDOPTS) -lpthread
|
||||
CXXFLAGS+=-g -Wall $(DEFINES)
|
||||
CFLAGS+=-g -Wall -std=c99 $(DEFINES)
|
||||
LDLIBS+=-lpthread
|
||||
|
||||
BINS=upgtool
|
||||
BINS=upgtool$(EXE_EXT)
|
||||
|
||||
all: $(BINS)
|
||||
|
||||
|
|
@ -30,11 +43,11 @@ all: $(BINS)
|
|||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
upgtool: upgtool.o upg.o misc.o mg.o keysig_search.o md5.o
|
||||
$(LD) -o $@ $^ $(LDFLAGS)
|
||||
upgtool$(EXE_EXT): upgtool.o upg.o misc.o mg.o keysig_search.o
|
||||
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
|
||||
clean:
|
||||
rm -fr *.o
|
||||
rm -rf *.o
|
||||
|
||||
veryclean:
|
||||
rm -rf $(BINS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue