Build system improvements for windows

- Add EXE extension correctly
- Detect windows with _WIN32 macro and retire UNIX macro
This commit is contained in:
Niels Nesse 2015-11-24 00:59:57 -08:00
parent d62d8e74ba
commit d4b1cda08d
4 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,4 @@
PROG = tbftss
CC = gcc
CXXFLAGS += -DUNIX
CC=gcc
EXEEXT=
include common.mk

View File

@ -1,4 +1,4 @@
PROG = tbftss.exe
EXEEXT=.exe
CC=x86_64-w64-mingw32-gcc
include common.mk

View File

@ -1,5 +1,7 @@
PROG = tbftss
TARGET=$(PROG)$(EXEEXT)
VERSION = 0.4
REVISION = $(shell date +"%y%m%d")
DEBUG = 0
@ -8,7 +10,7 @@ CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -
CXXFLAGS += -Wall -ansi -pedantic -Werror -Wstrict-prototypes
CXXFLAGS += -g -lefence
LIBS = `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
LIBS := `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
SEARCHPATH += src/ src/battle src/draw src/game src/galaxy src/json src/system src/test
vpath %.c $(SEARCHPATH)
@ -38,15 +40,15 @@ OBJS += waypoints.o widgets.o
DIST_FILES = data gfx manual music sound src LICENSE makefile README.md CHANGELOG
# top-level rule to create the program.
all: $(PROG)
all: $(TARGET)
# compiling other source files.
%.o: %.c %.h $(DEPS)
$(CC) $(CFLAGS) $(CXXFLAGS) -c $<
# linking the program.
$(PROG): $(OBJS)
$(CC) -o $(PROG) $(OBJS) $(LIBS)
$(TARGET): $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBS)
# prepare an archive for the program
dist:
@ -62,6 +64,6 @@ dist:
# cleaning everything that can be automatically recreated with "make".
clean:
$(RM) $(OBJS) $(PROG)
$(RM) $(OBJS) $(TARGET)
.PHONY: dist

View File

@ -20,6 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "init.h"
#ifndef _WIN32
#define UNIX 1
#endif
#if UNIX
static void createSaveFolder(void);
@ -97,7 +101,7 @@ void initSDL(void)
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Game scale factor: %.2f,%.2f\n", app.scaleX, app.scaleY);
}
#if UNIX
#ifdef UNIX
static void createSaveFolder(void)
{
char *userHome;