diff --git a/Example.GameLib/Makefile b/Example.GameLib/Makefile index e8417b8..0b2b862 100644 --- a/Example.GameLib/Makefile +++ b/Example.GameLib/Makefile @@ -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) diff --git a/Example.GameLib/dist-emscripten.sh b/Example.GameLib/dist-emscripten.sh index 5f41f94..529393d 100644 --- a/Example.GameLib/dist-emscripten.sh +++ b/Example.GameLib/dist-emscripten.sh @@ -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 diff --git a/Makefile b/Makefile index 3843f99..335f894 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/Makefile.emscripten.mk b/Makefile.emscripten.mk deleted file mode 100644 index 62a1ca0..0000000 --- a/Makefile.emscripten.mk +++ /dev/null @@ -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 - - diff --git a/Makefile.macosx b/Makefile.macosx deleted file mode 100644 index f5462a0..0000000 --- a/Makefile.macosx +++ /dev/null @@ -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 diff --git a/gamelib-config b/gamelib-config old mode 100644 new mode 100755 index 7a4126c..3dc37e3 --- a/gamelib-config +++ b/gamelib-config @@ -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"