]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix MinGW cross build from Unix
authorJohn Ericson <John.Ericson@Obsidian.Systems>
Tue, 12 Nov 2019 20:13:35 +0000 (15:13 -0500)
committerJohn Ericson <John.Ericson@Obsidian.Systems>
Thu, 14 Nov 2019 19:19:06 +0000 (14:19 -0500)
generate_res.bat seems rather pointless, am I missing something? I just
inlined it into the Makefile.

programs/Makefile
programs/windres/generate_res.bat [deleted file]

index 64dcae0028e76e7d24068b454a88384e13a04a93..5ed61f97fec5e7e95e0787b1ef3d7d7e99577d99 100644 (file)
@@ -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 (file)
index 7ff9aef..0000000
+++ /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
-)