fix makefile; add ios
This commit is contained in:
parent
5e3fb73398
commit
ecb2882e7e
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -21,5 +21,9 @@ primum.exe
|
||||||
core.cdb.h
|
core.cdb.h
|
||||||
jsc
|
jsc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
primum.html
|
*.html
|
||||||
.vscode
|
.vscode
|
||||||
|
primum*
|
||||||
|
Prosperon*
|
||||||
|
*.icns
|
||||||
|
game.cdb
|
260
Makefile
260
Makefile
|
@ -11,8 +11,6 @@ CC := $(notdir $(CC))
|
||||||
|
|
||||||
OPT ?= 0
|
OPT ?= 0
|
||||||
|
|
||||||
QJS :=
|
|
||||||
|
|
||||||
INFO :=
|
INFO :=
|
||||||
LD = $(CC)
|
LD = $(CC)
|
||||||
|
|
||||||
|
@ -40,10 +38,8 @@ ifdef NQOA
|
||||||
CPPFLAGS += -DNQOA
|
CPPFLAGS += -DNQOA
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS += -ffast-math
|
|
||||||
|
|
||||||
ifeq ($(CC), emcc)
|
ifeq ($(CC), emcc)
|
||||||
LDFLAGS += #--closure 1
|
LDFLAGS += #--closure 1 --emrun
|
||||||
CPPFLAGS += -O0
|
CPPFLAGS += -O0
|
||||||
OPT = 0
|
OPT = 0
|
||||||
NDEBUG = 1
|
NDEBUG = 1
|
||||||
|
@ -52,49 +48,41 @@ endif
|
||||||
|
|
||||||
ifdef NDEBUG
|
ifdef NDEBUG
|
||||||
CPPFLAGS += -DNDEBUG
|
CPPFLAGS += -DNDEBUG
|
||||||
LDFLAGS += -s
|
|
||||||
else
|
else
|
||||||
CPPFLAGS += -g
|
CPPFLAGS += -g -DDUMP
|
||||||
INFO += _dbg
|
INFO :=$(INFO)_dbg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef LEAK
|
ifdef LEAK
|
||||||
CPPFLAGS += -fsanitize=address
|
CPPFLAGS += -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -DLEAK
|
||||||
CPPFLAGS += -fsanitize=undefined
|
|
||||||
CPPFLAGS += -fno-omit-frame-pointer
|
|
||||||
QJS += LEAK
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef DUMP
|
|
||||||
QJS += DUMP
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OPT),small)
|
ifeq ($(OPT),small)
|
||||||
CPPFLAGS += -Oz -flto -fno-ident -fno-asynchronous-unwind-tables
|
CPPFLAGS += -Oz -flto -fno-ident -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections
|
||||||
|
|
||||||
LDFLAGS += -flto
|
LDFLAGS += -flto
|
||||||
|
|
||||||
ifeq ($(CC), emcc)
|
ifeq ($(CC), emcc)
|
||||||
LDFLAGS += --closure 1
|
LDFLAGS += --closure 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INFO := $(addsuffix _small,$(INFO))
|
INFO :=$(INFO)_small
|
||||||
else
|
else ifeq ($(OPT), 1)
|
||||||
ifeq ($(OPT), 1)
|
|
||||||
CPPFLAGS += -O2 -flto
|
CPPFLAGS += -O2 -flto
|
||||||
INFO := $(addsuffix _opt,$(INFO))
|
INFO :=$(INFO)_opt
|
||||||
else
|
else
|
||||||
CPPFLAGS += -O0
|
CPPFLAGS += -O2
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) -MD $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
|
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) -MD $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
|
||||||
|
|
||||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64 # for tinycdb
|
CPPFLAGS += -D_FILE_OFFSET_BITS=64 # for tinycdb
|
||||||
|
CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
|
||||||
|
|
||||||
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
||||||
# default, fast and medium available in game at runtime; best available in editor
|
# default, fast and medium available in game at runtime; best available in editor
|
||||||
|
|
||||||
PKGCMD = tar --directory $(BIN) --exclude="./*.a" --exclude="./obj" -czf $(DISTDIR)/$(DIST) .
|
PKGCMD = tar --directory --exclude="./*.a" --exclude="./obj" -czf $(DISTDIR)/$(DIST) .
|
||||||
ZIP = .tar.gz
|
ZIP = .tar.gz
|
||||||
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
||||||
|
|
||||||
|
@ -102,30 +90,28 @@ ifeq ($(ARCH),)
|
||||||
ARCH != uname -m
|
ARCH != uname -m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
STEAMPATH = steam/sdk/redistributable_bin
|
INFO :=$(INFO)_$(ARCH)
|
||||||
DISCORDPATH = discord/lib
|
|
||||||
|
|
||||||
ifdef DISCORD
|
ifeq ($(OS), Windows_NT) # then WINDOWS
|
||||||
LDPATHS += $(DISCORDPATH)/$(ARCH)
|
|
||||||
LDLIBS += discord_game_sdk
|
|
||||||
CPPFLAGS += -DDISCORD
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef STEAM
|
|
||||||
LDLIBS += steam_api
|
|
||||||
LDPATHS += $(STEAMPATH)/$(ARCH)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
|
||||||
LDFLAGS += -mwin32 -static
|
LDFLAGS += -mwin32 -static
|
||||||
CPPFLAGS += -mwin32
|
CPPFLAGS += -mwin32
|
||||||
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
|
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
|
||||||
EXT = .exe
|
EXT = .exe
|
||||||
ARCH := x86_64
|
PKGCMD = zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
|
||||||
PKGCMD = cd $(BIN); zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
|
|
||||||
ZIP = .zip
|
ZIP = .zip
|
||||||
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
||||||
else ifeq ($(CC), emcc)
|
INFO :=$(INFO)_win
|
||||||
|
else ifeq ($(OS), IOS)
|
||||||
|
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
|
||||||
|
SDK = iphoneos
|
||||||
|
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDK).platform/Developer/SDKs/$(SDK).sdk
|
||||||
|
CFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
||||||
|
LDFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
||||||
|
LDFLAGS += -framework Foundation -framework UIKit -framework AudioToolbox -framework Metal -framework MetalKit -framework AVFoundation
|
||||||
|
CXXFLAGS += -std=c++11
|
||||||
|
CFLAGS += -x objective-c
|
||||||
|
INFO :=$(INFO)_ios
|
||||||
|
else ifeq ($(CC), emcc) # Then WEB
|
||||||
OS := Web
|
OS := Web
|
||||||
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread -sTOTAL_MEMORY=128MB
|
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread -sTOTAL_MEMORY=128MB
|
||||||
CPPFLAGS += -pthread
|
CPPFLAGS += -pthread
|
||||||
|
@ -133,10 +119,11 @@ else ifeq ($(CC), emcc)
|
||||||
EXT = .html
|
EXT = .html
|
||||||
else
|
else
|
||||||
UNAME != uname -s
|
UNAME != uname -s
|
||||||
ifeq ($(UNAME), Linux)
|
ifeq ($(UNAME), Linux) # then LINUX
|
||||||
OS := Linux
|
OS := Linux
|
||||||
LDFLAGS += -pthread -rdynamic
|
LDFLAGS += -pthread -rdynamic
|
||||||
LDLIBS += GL pthread c m dl X11 Xi Xcursor EGL asound
|
LDLIBS += GL pthread c m dl X11 Xi Xcursor EGL asound
|
||||||
|
INFO :=$(INFO)_linux
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME), Darwin)
|
ifeq ($(UNAME), Darwin)
|
||||||
|
@ -145,42 +132,28 @@ else
|
||||||
CFLAGS += -x objective-c
|
CFLAGS += -x objective-c
|
||||||
CXXFLAGS += -std=c++11
|
CXXFLAGS += -std=c++11
|
||||||
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
|
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
|
||||||
|
INFO :=$(INFO)_macos
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BIN = bin/$(OS)/$(ARCH)$(INFO)
|
|
||||||
|
|
||||||
ifdef STEAM
|
|
||||||
BIN := $(addsuffix /steam, $(BIN))
|
|
||||||
endif
|
|
||||||
|
|
||||||
OBJDIR = $(BIN)/obj
|
|
||||||
|
|
||||||
# All other sources
|
# All other sources
|
||||||
OBJS != find source/engine -type f -name '*.c' | grep -vE 'test|tool|example|fuzz|main' | grep -vE 'quickjs'
|
OBJS != find source/engine -type f -name '*.c' | grep -vE 'test|tool|example|fuzz|main' | grep -vE 'quickjs'
|
||||||
CPPOBJS != find source/engine -type f -name '*.cpp' | grep -vE 'test|tool|example|fuzz|main'
|
CPPOBJS != find source/engine -type f -name '*.cpp' | grep -vE 'test|tool|example|fuzz|main'
|
||||||
OBJS += $(CPPOBJS)
|
OBJS += $(CPPOBJS)
|
||||||
OBJS += $(shell find source/engine -type f -name '*.m')
|
OBJS += $(shell find source/engine -type f -name '*.m')
|
||||||
OBJS := $(patsubst %.cpp, %.o, $(OBJS))
|
OBJS := $(patsubst %.cpp, %$(INFO).o, $(OBJS))
|
||||||
OBJS := $(patsubst %.c, %.o,$(OBJS))
|
OBJS := $(patsubst %.c, %$(INFO).o,$(OBJS))
|
||||||
OBJS := $(patsubst %.m, %.o, $(OBJS))
|
OBJS := $(patsubst %.m, %$(INFO).o, $(OBJS))
|
||||||
OBJS := $(addprefix $(BIN)/obj/, $(OBJS))
|
|
||||||
|
|
||||||
engineincs != find source/engine -maxdepth 1 -type d
|
engineincs != find source/engine -maxdepth 1 -type d
|
||||||
includeflag != find source -type d -name include
|
includeflag != find source -type d -name include
|
||||||
includeflag += $(engineincs) source/engine/thirdparty/tinycdb source/shaders source/engine/thirdparty/sokol source/engine/thirdparty/stb source/engine/thirdparty/cgltf source/engine/thirdparty/TinySoundFont source/engine/thirdparty/dr_libs
|
includeflag += $(engineincs) source/engine/thirdparty/tinycdb source/shaders source/engine/thirdparty/sokol source/engine/thirdparty/stb source/engine/thirdparty/cgltf source/engine/thirdparty/TinySoundFont source/engine/thirdparty/dr_libs
|
||||||
includeflag := $(addprefix -I, $(includeflag))
|
includeflag := $(addprefix -I, $(includeflag))
|
||||||
|
|
||||||
# Adding different SDKs
|
|
||||||
ifdef STEAM
|
|
||||||
includeflag += -Isteam/sdk/public
|
|
||||||
CPPFLAGS += -DSTEAM
|
|
||||||
# BIN += /steam
|
|
||||||
endif
|
|
||||||
|
|
||||||
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
|
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
|
||||||
|
|
||||||
NAME = primum$(EXT)
|
APP = prosperon
|
||||||
|
NAME = $(APP)$(INFO)$(EXT)
|
||||||
SEM != git describe --tags --abbrev=0
|
SEM != git describe --tags --abbrev=0
|
||||||
COM != git rev-parse --short HEAD
|
COM != git rev-parse --short HEAD
|
||||||
|
|
||||||
|
@ -190,116 +163,78 @@ LDPATHS := $(addprefix -L, $(LDPATHS))
|
||||||
DEPENDS = $(OBJS:.o=.d)
|
DEPENDS = $(OBJS:.o=.d)
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
DIST = yugine-$(OS)$(ARCH)$(INFO)-$(COM)$(ZIP)
|
|
||||||
DISTDIR = ./dist
|
|
||||||
|
|
||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
primum: all
|
all: $(NAME)
|
||||||
all: $(BIN)/$(NAME)
|
cp -f $(NAME) $(APP)
|
||||||
cp $(BIN)/$(NAME) .
|
|
||||||
|
|
||||||
DESTDIR ?= ~/.bin
|
DESTDIR ?= ~/.bin
|
||||||
|
|
||||||
CDB = source/engine/thirdparty/tinycdb
|
|
||||||
|
|
||||||
SHADERS = $(shell ls source/shaders/*.sglsl)
|
SHADERS = $(shell ls source/shaders/*.sglsl)
|
||||||
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
|
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
|
||||||
|
|
||||||
install: $(BIN)/$(NAME)
|
install: $(NAME)
|
||||||
cp -f $(BIN)/$(NAME) $(DESTDIR)
|
cp -f $(NAME) $(DESTDIR)/$(APP)
|
||||||
|
|
||||||
$(BIN)/$(NAME): $(BIN)/libengine.a $(BIN)/libquickjs.a
|
$(NAME): libengine$(INFO).a libquickjs$(INFO).a
|
||||||
@echo Linking $(NAME)
|
@echo Linking $(NAME)
|
||||||
$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L$(BIN) $(LDPATHS) $(LDLIBS) -o $@
|
$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
$(DISTDIR)/$(DIST): $(BIN)/$(NAME)
|
libengine$(INFO).a: $(OBJS)
|
||||||
@echo Creating distribution $(DIST)
|
$(AR) rcs $@ $(OBJS)
|
||||||
@mkdir -p $(DISTDIR)
|
|
||||||
@$(PKGCMD)
|
|
||||||
|
|
||||||
$(BIN)/libengine.a: $(OBJS)
|
|
||||||
@$(AR) rcs $@ $(OBJS)
|
|
||||||
|
|
||||||
CDB_C != find $(CDB) -name *.c
|
|
||||||
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
|
|
||||||
$(CDB)/libcdb.a:
|
|
||||||
rm -f $(CDB)/libcdb.a
|
|
||||||
make -C $(CDB) libcdb.a
|
|
||||||
|
|
||||||
tools/libcdb.a: $(CDB)/libcdb.a
|
|
||||||
cp $(CDB)/libcdb.a tools
|
|
||||||
|
|
||||||
DOCOS = Sound gameobject Game Window physics Profile Time Player Mouse IO Log ColorMap sprite SpriteAnim Render Geometry
|
|
||||||
DOCHTML := $(addsuffix .api.html, $(DOCOS))
|
|
||||||
DOCMD := $(addsuffix .api.md, $(DOCOS))
|
|
||||||
|
|
||||||
api.md: $(DOCMD)
|
|
||||||
@(echo "# API"; cat $^) > $@
|
|
||||||
@rm $^
|
|
||||||
|
|
||||||
INPUT = editor DebugControls component.sprite component.polygon2d component.edge2d component.circle2d
|
|
||||||
|
|
||||||
INPUTMD := $(addsuffix .input.md, $(INPUT))
|
|
||||||
input.md: $(INPUTMD)
|
|
||||||
@(echo "# Input"; cat $^) > $@
|
|
||||||
@rm $^
|
|
||||||
|
|
||||||
%.input.md: primum $(SCRIPTS)
|
|
||||||
@echo Printing controls for $*
|
|
||||||
@./primum -e $* > $@
|
|
||||||
|
|
||||||
%.api.md: primum $(SCRIPTS)
|
|
||||||
@echo Printing api for $*
|
|
||||||
@./primum -d $* > $@
|
|
||||||
|
|
||||||
QUICKJS := source/engine/thirdparty/quickjs
|
QUICKJS := source/engine/thirdparty/quickjs
|
||||||
$(BIN)/libquickjs.a:
|
libquickjs$(INFO).a: $(QUICKJS)/libregexp$(INFO).o $(QUICKJS)/quickjs$(INFO).o $(QUICKJS)/libunicode$(INFO).o $(QUICKJS)/cutils$(INFO).o $(QUICKJS)/libbf$(INFO).o
|
||||||
make -C $(QUICKJS) clean
|
$(AR) rcs $@ $^
|
||||||
make -C $(QUICKJS) AR=$(AR) HOST_CC=$(CC) LEAK=$(LEAK) DUMP=$(DUMP) libquickjs.a
|
|
||||||
@mkdir -p $(BIN)
|
|
||||||
cp -rf $(QUICKJS)/libquickjs.* $(BIN)
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.c source/engine/core.cdb.h $(SHADERS)
|
%$(INFO).o: %.c $(SHADERS) source/engine/core.cdb.h
|
||||||
@mkdir -p $(@D)
|
|
||||||
@echo Making C object $@
|
@echo Making C object $@
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.cpp
|
%$(INFO).o: %.cpp
|
||||||
@mkdir -p $(@D)
|
|
||||||
@echo Making C++ object $@
|
@echo Making C++ object $@
|
||||||
@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.m
|
%$(INFO).o: %.m
|
||||||
@mkdir -p $(@D)
|
|
||||||
@echo Making Objective-C object $@
|
@echo Making Objective-C object $@
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
shaders: $(SHADERS)
|
shaders: $(SHADERS)
|
||||||
@echo Making shaders
|
@echo Making shaders
|
||||||
|
|
||||||
%.sglsl.h:%.sglsl
|
%.sglsl.h:%.sglsl
|
||||||
@echo Creating shader $^
|
@echo Creating shader $^
|
||||||
@./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
|
./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
|
||||||
|
|
||||||
|
CDB = source/engine/thirdparty/tinycdb
|
||||||
|
CDB_C != find $(CDB) -name *.c
|
||||||
|
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
|
||||||
|
CDB_O := $(notdir $(CDB_O))
|
||||||
|
tools/libcdb.a: $(CDB_C)
|
||||||
|
cc -c $^
|
||||||
|
$(AR) rcs $@ $(CDB_O)
|
||||||
|
|
||||||
cdb: tools/cdb.c tools/libcdb.a
|
cdb: tools/cdb.c tools/libcdb.a
|
||||||
|
@echo Making cdb
|
||||||
cc $^ -I$(CDB) -o cdb
|
cc $^ -I$(CDB) -o cdb
|
||||||
|
|
||||||
source/engine/core.cdb.h: core.cdb
|
packer: tools/packer.c tools/libcdb.a
|
||||||
xxd -i $< > $@
|
@echo Making packer
|
||||||
|
cc $^ -I$(CDB) -o packer
|
||||||
SCRIPTS := $(shell ls scripts/*.js*)
|
|
||||||
SCRIPT_O := $(addsuffix o, $(SCRIPTS))
|
|
||||||
CORE != (ls icons/* fonts/*)
|
|
||||||
CORE := $(CORE) $(SCRIPTS)
|
|
||||||
|
|
||||||
core.cdb: packer $(CORE)
|
core.cdb: packer $(CORE)
|
||||||
./packer $(CORE)
|
./packer $(CORE)
|
||||||
chmod 644 out.cdb
|
chmod 644 out.cdb
|
||||||
mv out.cdb core.cdb
|
mv out.cdb core.cdb
|
||||||
|
|
||||||
packer: tools/packer.c tools/libcdb.a
|
source/engine/core.cdb.h: core.cdb
|
||||||
cc $^ -I$(CDB) -o packer
|
@echo Packing core.cdb.h
|
||||||
|
xxd -i $< > $@
|
||||||
|
|
||||||
|
SCRIPTS := $(shell ls scripts/*.js*)
|
||||||
|
SCRIPT_O := $(addsuffix o, $(SCRIPTS))
|
||||||
|
CORE != (ls icons/* fonts/*)
|
||||||
|
CORE := $(CORE) $(SCRIPTS)
|
||||||
|
|
||||||
jsc: tools/jso.c tools/libquickjs.a
|
jsc: tools/jso.c tools/libquickjs.a
|
||||||
$(CC) $^ -lm -Iquickjs -o $@
|
$(CC) $^ -lm -Iquickjs -o $@
|
||||||
|
@ -308,37 +243,50 @@ tools/libquickjs.a: $(BIN)/libquickjs.a
|
||||||
cp -f $(BIN)/libquickjs.a tools
|
cp -f $(BIN)/libquickjs.a tools
|
||||||
|
|
||||||
WINCC = x86_64-w64-mingw32-gcc
|
WINCC = x86_64-w64-mingw32-gcc
|
||||||
#WINCC = i686-w64-mingw32-g++
|
crosswin: packer
|
||||||
.PHONY: crosswin
|
make CC=$(WINCC) OS=Windows_NT ARCH=x86_64 DEBUG=$(DEBUG) OPT=$(OPT)
|
||||||
crosswin:
|
|
||||||
make packer
|
|
||||||
make CC=$(WINCC) OS=Windows_NT
|
|
||||||
|
|
||||||
crossmac:
|
crossios:
|
||||||
make ARCH=arm64
|
make OS=IOS ARCH=arm64 DEBUG=$(DEBUG) OPT=$(OPT)
|
||||||
mv primum primum_arm64
|
|
||||||
make ARCH=x86_64
|
ICNSIZE = 16 32 128 256 512 1024
|
||||||
mv primum primum_x86_64
|
Prosperon.icns: icons/moon.gif
|
||||||
lipo primum_arm64 primum_x86_64 -create -output primum
|
mkdir -p Prosperon.iconset
|
||||||
|
for i in $(ICNSIZE); do magick icons/moon.gif -size $${i}x$${i} Prosperon.iconset/icon_$${i}x$${i}.png; done
|
||||||
|
iconutil -c icns Prosperon.iconset
|
||||||
|
|
||||||
|
crossmac: Prosperon.icns
|
||||||
|
make ARCH=arm64 DEBUG=$(DEBUG) OPT=$(OPT)
|
||||||
|
mv $(APP) mac_arm64
|
||||||
|
make ARCH=x86_64 DEBUG=$(DEBUG) OPT=$(OPT)
|
||||||
|
mv $(APP) mac_x86_64
|
||||||
|
lipo mac_arm64 mac_x86_64 -create -output $(APP)_mac
|
||||||
|
rm mac_arm64 mac_x86_64
|
||||||
|
rm -rf Prosperon.app
|
||||||
|
mkdir Prosperon.app
|
||||||
|
mkdir Prosperon.app/Contents
|
||||||
|
mkdir Prosperon.app/Contents/MacOS
|
||||||
|
mkdir Prosperon.app/Contents/Resources
|
||||||
|
mv $(NAME) Prosperon.app/Contents/MacOS/Prosperon
|
||||||
|
cp Info.plist Prosperon.app/Contents
|
||||||
|
cp Prosperon.icns Prosperon.app/Contents/Resources
|
||||||
|
|
||||||
crossweb:
|
crossweb:
|
||||||
make packer
|
|
||||||
make CC=emcc
|
make CC=emcc
|
||||||
|
|
||||||
|
playweb:
|
||||||
|
make crossweb
|
||||||
|
emrun $(NAME).html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning project
|
@echo Cleaning project
|
||||||
rm -rf bin dist
|
rm -f source/shaders/*.h core.cdb jso cdb packer TAGS source/engine/core.cdb.h tools/libcdb.a **.a **.o **.d $(APP)* *.icns
|
||||||
rm -f source/shaders/*.h core.cdb jso cdb packer TAGS source/engine/core.cdb.h tools/libcdb.a $(CDB)/libcdb.a
|
rm -rf Prosperon.app
|
||||||
rm -f $(CDB)/*.o
|
|
||||||
@make -C $(QUICKJS) clean
|
|
||||||
|
|
||||||
docs: doc/prosperon.org
|
docs: doc/prosperon.org
|
||||||
make -C doc
|
make -C doc
|
||||||
mv doc/html .
|
mv doc/html .
|
||||||
|
|
||||||
test:
|
|
||||||
@echo No tests yet ...
|
|
||||||
|
|
||||||
TAGINC != find . -name "*.[chj]"
|
TAGINC != find . -name "*.[chj]"
|
||||||
tags: $(TAGINC)
|
tags: $(TAGINC)
|
||||||
@echo Making tags.
|
@echo Making tags.
|
||||||
|
|
|
@ -77,6 +77,7 @@ Object.assign(console, {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.stdout_lvl = 1;
|
||||||
console.log = console.say;
|
console.log = console.say;
|
||||||
var say = console.say;
|
var say = console.say;
|
||||||
var print = console.print;
|
var print = console.print;
|
||||||
|
|
|
@ -291,7 +291,7 @@ Cmdline.register_order("pack", function(str) {
|
||||||
|
|
||||||
say(`Packing into ${packname}`);
|
say(`Packing into ${packname}`);
|
||||||
|
|
||||||
io.pack_engine(packname);n
|
io.pack_engine(packname);
|
||||||
io.chmod(packname, 666);
|
io.chmod(packname, 666);
|
||||||
}, "Pack the game into the given name.", "NAME");
|
}, "Pack the game into the given name.", "NAME");
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ void mYughLog(int category, int priority, int line, const char *file, const char
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priority >= LOG_ERROR)
|
//if (priority >= LOG_ERROR)
|
||||||
raise(SIGINT);
|
//js_stacktrace();
|
||||||
|
//raise(SIGINT);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -805,7 +805,7 @@ JSC_CCALL(os_make_edge2d,
|
||||||
|
|
||||||
JSC_SCALL(os_make_texture,
|
JSC_SCALL(os_make_texture,
|
||||||
ret = texture2js(texture_from_file(str));
|
ret = texture2js(texture_from_file(str));
|
||||||
YughInfo("MADE TEXTURE");
|
YughInfo("Made texture with %s", str);
|
||||||
JS_SetPropertyStr(js, ret, "path", JS_DupValue(js,argv[0]));
|
JS_SetPropertyStr(js, ret, "path", JS_DupValue(js,argv[0]));
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue