From 0ede342acc2c26f87ae962fa88e158904d4198c4 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 12 Nov 2019 15:13:35 -0500 Subject: [PATCH] Fix MinGW cross build from Unix generate_res.bat seems rather pointless, am I missing something? I just inlined it into the Makefile. --- programs/Makefile | 26 +++++++++++++++++--------- programs/windres/generate_res.bat | 11 ----------- 2 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 programs/windres/generate_res.bat diff --git a/programs/Makefile b/programs/Makefile index 64dcae00..5ed61f97 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -165,15 +165,15 @@ $(ZSTDDECOMP_O): CFLAGS += $(ALIGN_LOOP) zstd : CPPFLAGS += $(THREAD_CPP) $(ZLIBCPP) $(LZMACPP) $(LZ4CPP) zstd : LDFLAGS += $(THREAD_LD) $(ZLIBLD) $(LZMALD) $(LZ4LD) $(DEBUGFLAGS_LD) zstd : CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) +ifneq (,$(filter Windows%,$(OS))) +zstd : $(RES_FILE) +endif zstd : $(ZSTDLIB_FILES) zstdcli.o util.o timefn.o fileio.o benchfn.o benchzstd.o datagen.o dibio.o @echo "$(THREAD_MSG)" @echo "$(ZLIB_MSG)" @echo "$(LZMA_MSG)" @echo "$(LZ4_MSG)" -ifneq (,$(filter Windows%,$(OS))) - windres/generate_res.bat -endif - $(CC) $(FLAGS) $^ $(RES_FILE) -o $@$(EXT) $(LDFLAGS) + $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS) .PHONY: zstd-release zstd-release: DEBUGFLAGS := -DBACKTRACE_ENABLE=0 @@ -183,11 +183,11 @@ zstd-release: zstd zstd32 : CPPFLAGS += $(THREAD_CPP) zstd32 : LDFLAGS += $(THREAD_LD) zstd32 : CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) -zstd32 : $(ZSTDLIB_FILES) zstdcli.c util.c timefn.c fileio.c benchfn.c benchzstd.c datagen.c dibio.c ifneq (,$(filter Windows%,$(OS))) - windres/generate_res.bat +zstd32 : $(RES32_FILE) endif - $(CC) -m32 $(FLAGS) $^ $(RES32_FILE) -o $@$(EXT) +zstd32 : $(ZSTDLIB_FILES) zstdcli.c util.c timefn.c fileio.c benchfn.c benchzstd.c datagen.c dibio.c + $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) zstd-nolegacy : $(ZSTD_FILES) $(ZDICT_FILES) zstdcli.o util.o fileio.c benchfn.o benchzstd.o timefn.o datagen.o dibio.o $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS) @@ -235,8 +235,16 @@ zstdmt: zstd ln -sf zstd zstdmt .PHONY: generate_res -generate_res: - windres/generate_res.bat +generate_res: $(RES64_FILE) $(RES32_FILE) + +ifneq (,$(filter Windows%,$(OS))) +RC ?= windres +# http://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable +$(RES64_FILE): windres/zstd.rc + $(RC) -o $@ -I ../lib -I windres -i $< -O coff -F pe-x86-64 +$(RES32_FILE): windres/zstd.rc + $(RC) -o $@ -I ../lib -I windres -i $< -O coff -F pe-i386 +endif .PHONY: clean clean: diff --git a/programs/windres/generate_res.bat b/programs/windres/generate_res.bat deleted file mode 100644 index 7ff9aef5..00000000 --- a/programs/windres/generate_res.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -REM http://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable - -where /q windres.exe -IF ERRORLEVEL 1 ( - ECHO The windres.exe is missing. Ensure it is installed and placed in your PATH. - EXIT /B -) ELSE ( - windres.exe -I ../lib -I windres -i windres/zstd.rc -O coff -F pe-x86-64 -o windres/zstd64.res - windres.exe -I ../lib -I windres -i windres/zstd.rc -O coff -F pe-i386 -o windres/zstd32.res -)