From 3f4019dfbeea0b5e3b0bc657f1bad6bc2b53dd42 Mon Sep 17 00:00:00 2001 From: Michael Georgoulopoulos Date: Sun, 8 May 2022 21:37:03 +0300 Subject: [PATCH] Fixes for compiling under msys2 --- GNUmakefile | 2 +- src/bsptree.c | 4 ++++ src/glut/audio.c | 4 ++-- src/treestor.c | 2 +- tools/csprite/src/main.c | 4 ++++ tools/img2bin/Makefile | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index ee7a35e..834db7b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -27,7 +27,7 @@ endif sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/; s/IRIX.*/IRIX/') ifeq ($(sys), mingw) - obj = $(src:.c=.w32.o) + obj = $(src:.c=.w32.o) $(asmsrc:.asm=.w32.o) bin = demo_win32.exe diff --git a/src/bsptree.c b/src/bsptree.c index 7db5711..d6417b9 100644 --- a/src/bsptree.c +++ b/src/bsptree.c @@ -6,8 +6,12 @@ #if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__DJGPP__) #include #else +#ifdef WIN32 +#include +#else #include #endif +#endif #include "bsptree.h" #include "dynarr.h" #include "inttypes.h" diff --git a/src/glut/audio.c b/src/glut/audio.c index c776d3b..a7ea50c 100644 --- a/src/glut/audio.c +++ b/src/glut/audio.c @@ -63,7 +63,7 @@ int au_init(void) { #ifdef _WIN32 HANDLE thr; - if((thr = CreateThread(0, 0, update, 0, 0, 0))) { + if((thr = CreateThread(0, 0, upd_thread, 0, 0, 0))) { CloseHandle(thr); } #else @@ -169,7 +169,7 @@ void au_update(void) } #ifdef _WIN32 -static DWORD WINAPI upd_thread(void *cls); +static DWORD WINAPI upd_thread(void *cls) #else static void *update(void *cls) #endif diff --git a/src/treestor.c b/src/treestor.c index 91adfec..69853c8 100644 --- a/src/treestor.c +++ b/src/treestor.c @@ -4,7 +4,7 @@ #include #include "treestor.h" -#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__DJGPP__) +#if defined(__WATCOMC__) || defined(WIN32) || defined(__DJGPP__) #include #else #include diff --git a/tools/csprite/src/main.c b/tools/csprite/src/main.c index a59aa3e..c549b3e 100644 --- a/tools/csprite/src/main.c +++ b/tools/csprite/src/main.c @@ -3,7 +3,11 @@ #include #include #include +#ifdef WIN32 +#include +#else #include +#endif #include "image.h" struct rect { diff --git a/tools/img2bin/Makefile b/tools/img2bin/Makefile index b6e9f4e..5e525cb 100644 --- a/tools/img2bin/Makefile +++ b/tools/img2bin/Makefile @@ -4,7 +4,7 @@ bin = img2bin root = ../.. CFLAGS = -pedantic -Wall -g -I$(root)/libs/imago/src -LDFLAGS = -L$(root)/libs/imago -limago -lm +LDFLAGS = -L$(root)/libs/imago -limago -lpng -ljpeg -lz -L/usr/local/lib -lm $(bin): $(obj) $(CC) -o $@ $(obj) $(LDFLAGS) -- 1.7.10.4