Adjust build for Linux

This commit is contained in:
2022-04-04 18:17:32 +02:00
parent b55b9b3138
commit c77e90ab76
6 changed files with 28 additions and 63 deletions

View File

@@ -20,16 +20,17 @@ LDFLAGS := $(shell $(GameLibConfig) $(ARCH) --ldflags)
RES_GAME := game$(EXEEXT)
BUILDDIR := build-$(PLATFORM)
IsMinGW := $(findstring MINGW,$(shell uname -s)) $(findstring MSYS,$(shell uname -s))
IsDarwin := $(findstring Darwin,$(shell uname -s))
ifneq (,$(IsMinGW))
HOST_ARCH :=
HOST_OS := $(shell uname -o )
HOST_KERNEL := $(shell uname -s )
ifeq ($(HOST_OS),Msys)
HOST_ARCH := mingw
else
ifneq (,$(IsDarwin))
HOST_ARCH := macosx
else
endif
ifeq ($(HOST_KERNEL),Linux)
HOST_ARCH := linux
endif
ifeq ($(HOST_KERNEL),Darwin)
HOST_ARCH := macosx
endif
ifeq ($(HOST_ARCH),mingw)

View File

@@ -1,4 +1,8 @@
source /c/emsdk/emsdk_env.sh
#!/bin/sh
if test -f /c/emsdk/emsdk_env.sh; then
source /c/emsdk/emsdk_env.sh
fi
make arch=emscripten full-clean
make arch=emscripten

View File

@@ -1,20 +1,17 @@
VERBOSE_BUILD := false
IsMinGW := $(findstring MINGW,$(shell uname -s)) $(findstring MSYS,$(shell uname -s))
IsDarwin := $(findstring Darwin,$(shell uname -s))
ifneq (,$(IsMinGW))
HOST_ARCH :=
HOST_OS := $(shell uname -o )
HOST_KERNEL := $(shell uname -s )
ifeq ($(HOST_OS),Msys)
HOST_ARCH := mingw
else
ifneq (,$(IsDarwin))
HOST_ARCH := macosx
else
endif
ifeq ($(HOST_KERNEL),Linux)
HOST_ARCH := linux
endif
endif
ifeq ($(arch),emscripten)
HOST_ARCH := emscripten
ifeq ($(HOST_KERNEL),Darwin)
HOST_ARCH := macosx
endif
@@ -31,7 +28,7 @@ ifeq ($(HOST_ARCH),mingw)
LDFLAGS := -g -mwindows -D_GNU_SOURCE=1
RES_GAMELIB := libgame.a
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut --delimiter=' ' --fields=2)
BUILDDIR := build-$(shell gcc -dumpmachine )
endif
ifeq ($(HOST_ARCH),linux)
CC := gcc
@@ -47,7 +44,7 @@ ifeq ($(HOST_ARCH),linux)
RES_GAMELIB := libgame.a
RES_GAME := game
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut --delimiter=' ' --fields=2)
BUILDDIR := build-$(shell gcc -dumpmachine )
endif
ifeq ($(HOST_ARCH),macosx)
CC := gcc
@@ -62,18 +59,15 @@ ifeq ($(HOST_ARCH),macosx)
LDFLAGS :=
RES_GAMELIB := libgame.a
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut -d ' ' -f 2)
BUILDDIR := build-$(shell gcc -dumpmachine )
endif
ifeq ($(HOST_ARCH),emscripten)
ifeq ($(arch),emscripten)
CC := emcc
AR := emar
LAUNCHER := emrun --port 8080
RM := rm -rf
MKDIR := mkdir
ECHO := echo
LIBS :=
CFLAGS := -s FULL_ES2=1 -s ASM_JS=1 -s USE_SDL=2 -O2 -Wno-implicit-function-declaration -DEMSCRIPTEN
CFLAGS := -s USE_SDL=2 -O2 -Wno-implicit-function-declaration -DEMSCRIPTEN
LDFLAGS := --preload-file data -s TOTAL_MEMORY=134217728 -lidbfs.js
RES_GAMELIB := libgame.a

View File

@@ -1,18 +0,0 @@
CC := emcc
AR := emar
LAUNCHER := emrun --port 8080
RM := del /Q /S
MKDIR := mkdir
ECHO := echo
VERBOSE_BUILD := false
LIBS :=
CFLAGS := -s FULL_ES2=1 -s ASM_JS=1 -s USE_SDL=2 -O2 -Wno-implicit-function-declaration -DEMSCRIPTEN
LDFLAGS := --preload-file data -s TOTAL_MEMORY=134217728 -lidbfs.js
RES_GAMELIB := libgame.a
BUILDDIR := build-emscripten
include Makefile.common.mk

View File

@@ -1,16 +0,0 @@
CC := gcc
AR := ar
LAUNCHER :=
RM := rm -rf
MKDIR := mkdir
ECHO := echo
LIBS := -framework Cocoa -lm -framework OpenGL -framework SDL macosx/SDLMain.m
CFLAGS := -Wall -g -DMACOSX -ObjC -Dmain=SDL_main -I/usr/include/ -I/usr/include/SDL/ -I/usr/X11R6/include/
LDFLAGS :=
RES_GAMELIB := libgame.a
RES_GAME := game
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut -d ' ' -f 2)
include Makefile.common

4
gamelib-config Normal file → Executable file
View File

@@ -12,7 +12,7 @@ fi
# Preparar configuracion
uname=$( uname )
unamem=$( uname -m )
gcctarget=$( gcc -v 2>&1 | grep "Target:" | cut --delimiter=' ' --fields=2 )
gcctarget=$( gcc -dumpmachine )
if test $# -gt 0; then
if test $1 = "emscripten"; then
uname="EMSCRIPTEN"
@@ -36,7 +36,7 @@ case "$uname" in
*EMSCRIPTEN*)
# Configuracion de Emscripten
libs=""
cflags="-s FULL_ES2=1 -s ASM_JS=1 -s USE_SDL=2 -O2 -Wno-implicit-function-declaration -I$prefix/src"
cflags="-s USE_SDL=2 -O2 -Wno-implicit-function-declaration -I$prefix/src"
builddir="build-emscripten"
platform="emscripten"
exeextension=".html"