prepare Makefile to allow build with SDL, SDL2 or another "video API"
update Visual C project as well
This commit is contained in:
parent
9d46d1e90f
commit
c6975afe94
@ -4,7 +4,7 @@ MAKENSIS = makensis
|
|||||||
UNZIP = unzip -o
|
UNZIP = unzip -o
|
||||||
SED = sed
|
SED = sed
|
||||||
|
|
||||||
VERSIONTAG = ../obj/win32/versiontag
|
VERSIONTAG = ../obj/win32-sdl/versiontag
|
||||||
VERSION := $(shell cat $(VERSIONTAG))
|
VERSION := $(shell cat $(VERSIONTAG))
|
||||||
|
|
||||||
SOURCES = ../src-$(VERSION).tgz
|
SOURCES = ../src-$(VERSION).tgz
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_SDL;NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_SDL;NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -93,6 +93,7 @@
|
|||||||
<ClInclude Include="..\..\src\errors.h" />
|
<ClInclude Include="..\..\src\errors.h" />
|
||||||
<ClInclude Include="..\..\src\factory.h" />
|
<ClInclude Include="..\..\src\factory.h" />
|
||||||
<ClInclude Include="..\..\src\filesel.h" />
|
<ClInclude Include="..\..\src\filesel.h" />
|
||||||
|
<ClInclude Include="..\..\src\gfx2surface.h" />
|
||||||
<ClInclude Include="..\..\src\global.h" />
|
<ClInclude Include="..\..\src\global.h" />
|
||||||
<ClInclude Include="..\..\src\graph.h" />
|
<ClInclude Include="..\..\src\graph.h" />
|
||||||
<ClInclude Include="..\..\src\haiku.h" />
|
<ClInclude Include="..\..\src\haiku.h" />
|
||||||
@ -153,6 +154,7 @@
|
|||||||
<ClCompile Include="..\..\src\factory.c" />
|
<ClCompile Include="..\..\src\factory.c" />
|
||||||
<ClCompile Include="..\..\src\fileformats.c" />
|
<ClCompile Include="..\..\src\fileformats.c" />
|
||||||
<ClCompile Include="..\..\src\filesel.c" />
|
<ClCompile Include="..\..\src\filesel.c" />
|
||||||
|
<ClCompile Include="..\..\src\gfx2surface.c" />
|
||||||
<ClCompile Include="..\..\src\graph.c" />
|
<ClCompile Include="..\..\src\graph.c" />
|
||||||
<ClCompile Include="..\..\src\help.c" />
|
<ClCompile Include="..\..\src\help.c" />
|
||||||
<ClCompile Include="..\..\src\hotkeys.c" />
|
<ClCompile Include="..\..\src\hotkeys.c" />
|
||||||
|
|||||||
@ -177,6 +177,9 @@
|
|||||||
<ClInclude Include="..\..\src\recoil.h">
|
<ClInclude Include="..\..\src\recoil.h">
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\gfx2surface.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\..\src\gfx2.rc">
|
<ResourceCompile Include="..\..\src\gfx2.rc">
|
||||||
@ -349,5 +352,8 @@
|
|||||||
<ClCompile Include="..\..\src\recoil.c">
|
<ClCompile Include="..\..\src\recoil.c">
|
||||||
<Filter>Fichiers sources</Filter>
|
<Filter>Fichiers sources</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\gfx2surface.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
21
src/Makefile
21
src/Makefile
@ -57,10 +57,13 @@ ifneq (,$(LABEL))
|
|||||||
RES := $(shell if [ ! -f $(LABEL_CACHE) ] || [ "`cat $(LABEL_CACHE)`" != "$(LABEL)" ] ; then echo "$(LABEL)" > $(LABEL_CACHE) ; fi )
|
RES := $(shell if [ ! -f $(LABEL_CACHE) ] || [ "`cat $(LABEL_CACHE)`" != "$(LABEL)" ] ; then echo "$(LABEL)" > $(LABEL_CACHE) ; fi )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS_CACHE = .cflags.cache
|
CFLAGS_CACHE = $(OBJDIR)/.cflags.cache
|
||||||
|
|
||||||
RECOILVER = 4.3.0
|
RECOILVER = 4.3.0
|
||||||
|
|
||||||
|
# Video / input API used
|
||||||
|
API ?= sdl
|
||||||
|
|
||||||
### PLATFORM DETECTION AND CONFIGURATION ###
|
### PLATFORM DETECTION AND CONFIGURATION ###
|
||||||
|
|
||||||
PLATFORMOBJ =
|
PLATFORMOBJ =
|
||||||
@ -539,6 +542,17 @@ ifdef NORECOIL
|
|||||||
COPT += -DNORECOIL
|
COPT += -DNORECOIL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OBJDIR := $(OBJDIR)-$(API)
|
||||||
|
|
||||||
|
ifeq ($(API),sdl)
|
||||||
|
APIOBJ = sdlscreen.o
|
||||||
|
COPT += -DUSE_SDL
|
||||||
|
endif
|
||||||
|
ifeq ($(API),sdl2)
|
||||||
|
#APIOBJ = sdlscreen.o
|
||||||
|
COPT += -DUSE_SDL2
|
||||||
|
endif
|
||||||
|
|
||||||
#To enable Joystick emulation of cursor, make USE_JOYSTICK=1 (for input.o)
|
#To enable Joystick emulation of cursor, make USE_JOYSTICK=1 (for input.o)
|
||||||
#This can be necessary to test cursor code on a PC, but by default for all
|
#This can be necessary to test cursor code on a PC, but by default for all
|
||||||
#non-console platforms the joystick is disabled, to avoid reporting
|
#non-console platforms the joystick is disabled, to avoid reporting
|
||||||
@ -553,7 +567,7 @@ endif
|
|||||||
.PHONY : all debug release clean depend zip force install uninstall valgrind
|
.PHONY : all debug release clean depend zip force install uninstall valgrind
|
||||||
|
|
||||||
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
|
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
|
||||||
OBJS = main.o init.o graph.o sdlscreen.o misc.o special.o \
|
OBJS = main.o init.o graph.o $(APIOBJ) misc.o special.o \
|
||||||
buttons.o palette.o help.o operatio.o pages.o loadsave.o \
|
buttons.o palette.o help.o operatio.o pages.o loadsave.o \
|
||||||
readline.o engine.o filesel.o op_c.o readini.o saveini.o \
|
readline.o engine.o filesel.o op_c.o readini.o saveini.o \
|
||||||
shade.o keyboard.o io.o version.o text.o SFont.o setup.o \
|
shade.o keyboard.o io.o version.o text.o SFont.o setup.o \
|
||||||
@ -739,9 +753,10 @@ pversion.c: $(LABEL_CACHE)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
$(OBJDIR)/versiontag: pversion.c $(REVISION_CACHE)
|
$(OBJDIR)/versiontag: pversion.c $(REVISION_CACHE)
|
||||||
|
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
|
||||||
echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.$(GIT_REVISION) | tr " :" "_-" | sed -e "s/\([wW][iI][pP]\)\\./\1/" > $(OBJDIR)/versiontag
|
echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.$(GIT_REVISION) | tr " :" "_-" | sed -e "s/\([wW][iI][pP]\)\\./\1/" > $(OBJDIR)/versiontag
|
||||||
|
|
||||||
RES := $(shell if [ ! -f $(CFLAGS_CACHE) ] || [ "`cat $(CFLAGS_CACHE)`" != "$(COPT) $(CFLAGS)" ] ; then echo "$(COPT) $(CFLAGS)" > $(CFLAGS_CACHE) ; fi )
|
RES := $(shell $(MKDIR) $(OBJDIR) ; if [ ! -f $(CFLAGS_CACHE) ] || [ "`cat $(CFLAGS_CACHE)`" != "$(COPT) $(CFLAGS)" ] ; then echo "$(COPT) $(CFLAGS)" > $(CFLAGS_CACHE) ; fi )
|
||||||
|
|
||||||
ifndef NORECOIL
|
ifndef NORECOIL
|
||||||
recoil.c: ../3rdparty/recoil-$(RECOILVER)/recoil.c
|
recoil.c: ../3rdparty/recoil-$(RECOILVER)/recoil.c
|
||||||
|
|||||||
2
src/io.c
2
src/io.c
@ -38,7 +38,7 @@
|
|||||||
#include <proto/dos.h>
|
#include <proto/dos.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#elif defined(__WIN32__)
|
#elif defined(WIN32)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
6
src/io.h
6
src/io.h
@ -36,6 +36,10 @@
|
|||||||
/// - Also, don't assume "/" or "\\", use PATH_SEPARATOR
|
/// - Also, don't assume "/" or "\\", use PATH_SEPARATOR
|
||||||
/// If you don't, you break another platform.
|
/// If you don't, you break another platform.
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef IO_H__
|
||||||
|
#define IO_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/// Reads a single byte from an open file. Returns true if OK, false if a file i/o error occurred.
|
/// Reads a single byte from an open file. Returns true if OK, false if a file i/o error occurred.
|
||||||
int Read_byte(FILE *file, byte *dest);
|
int Read_byte(FILE *file, byte *dest);
|
||||||
@ -151,3 +155,5 @@ int Remove_path(const char * path);
|
|||||||
///
|
///
|
||||||
/// Remove the directory
|
/// Remove the directory
|
||||||
int Remove_directory(const char * path);
|
int Remove_directory(const char * path);
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user