rockbox/utils/nwztools/upgtools/Makefile
Amaury Pouly 1b5e824405 nwztool/upgtool: add support for compression
To decompress some output file(s), simply pass -z <idx> where idx is the index
of the file to decompress, starting from 0. For example
  upgtool -e NW_WM_FW.UPG -o tmp/ -m nw-wm1a -z 6 -z 7
to decompress files 6 and 7. To compress file, use the same options:
  upgtool -c NW_WM_FW.UPG -m nw-wm1a -z 2 script.sh md5sum.txt system.img

Change-Id: I1ef0b3e02c98e58154f1a959fb1ad70ad2ce6500
2020-10-11 13:08:03 +02:00

53 lines
1.3 KiB
Makefile

DEFINES=
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 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 -Wall $(DEFINES)
CFLAGS+=-g -Wall -std=c99 $(DEFINES)
LDLIBS+=-lpthread -lz
BINS=upgtool$(EXE_EXT)
all: $(BINS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
upgtool$(EXE_EXT): upgtool.o upg.o misc.o mg.o keysig_search.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
clean:
rm -rf *.o
veryclean:
rm -rf $(BINS)