2023-09-18 07:36:07 -05:00
|
|
|
MAKEFLAGS = --jobs=4
|
2022-02-03 09:16:22 -06:00
|
|
|
UNAME != uname
|
2023-09-19 12:35:12 -05:00
|
|
|
MAKEDIR != pwd
|
2022-12-12 01:35:42 -06:00
|
|
|
# Options
|
2023-05-24 20:45:50 -05:00
|
|
|
# DBG --- build with debugging symbols and logging
|
2023-09-03 12:50:02 -05:00
|
|
|
|
2023-11-20 15:57:23 -06:00
|
|
|
CXX:=$(CC)
|
|
|
|
|
|
|
|
ifeq ($(CXX), tcc)
|
|
|
|
CXX=clang
|
|
|
|
endif
|
|
|
|
|
2023-11-20 07:49:14 -06:00
|
|
|
ifeq ($(CC),cc)
|
|
|
|
CC=clang
|
|
|
|
endif
|
2023-09-03 12:50:02 -05:00
|
|
|
# Temp to strip long emcc paths to just emcc
|
|
|
|
CC := $(notdir $(CC))
|
|
|
|
|
|
|
|
DBG ?= 1
|
2023-09-04 09:48:44 -05:00
|
|
|
OPT ?= 0
|
2024-02-23 16:05:30 -06:00
|
|
|
LEAK ?= 0
|
2022-12-12 01:35:42 -06:00
|
|
|
|
2023-09-03 12:50:02 -05:00
|
|
|
INFO :=
|
2023-09-04 21:35:05 -05:00
|
|
|
LD = $(CC)
|
2023-09-03 12:50:02 -05:00
|
|
|
|
2023-09-25 08:21:02 -05:00
|
|
|
ifeq ($(CC), x86_64-w64-mingw32-gcc)
|
|
|
|
AR = x86_64-w64-mingw32-ar
|
|
|
|
endif
|
2023-09-05 10:44:52 -05:00
|
|
|
|
2023-09-12 23:32:14 -05:00
|
|
|
ifdef NEDITOR
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNO_EDITOR
|
2023-09-12 23:32:14 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef NFLAC
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNFLAC
|
2023-09-12 23:32:14 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef NMP3
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNMP3
|
2023-09-12 23:32:14 -05:00
|
|
|
endif
|
|
|
|
|
2023-11-20 15:57:23 -06:00
|
|
|
ifdef NSVG
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNSVG
|
2023-11-20 15:57:23 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef NQOA
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNQOA
|
2023-11-20 15:57:23 -06:00
|
|
|
endif
|
|
|
|
|
2023-12-21 17:21:01 -06:00
|
|
|
CPPFLAGS += -ffast-math
|
|
|
|
|
2024-03-04 11:15:55 -06:00
|
|
|
ifeq ($(CC), emcc)
|
|
|
|
LDFLAGS += #--closure 1
|
|
|
|
CPPFLAGS += -O0
|
|
|
|
OPT = 0
|
|
|
|
DBG = 0
|
|
|
|
AR = emar
|
|
|
|
endif
|
|
|
|
|
2023-09-03 12:50:02 -05:00
|
|
|
ifeq ($(DBG),1)
|
2023-12-26 15:39:46 -06:00
|
|
|
CPPFLAGS += -g
|
2023-09-06 17:48:08 -05:00
|
|
|
INFO += _dbg
|
2022-12-23 13:48:29 -06:00
|
|
|
else
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DNDEBUG
|
2023-09-04 16:27:30 -05:00
|
|
|
LDFLAGS += -s
|
2022-12-12 01:35:42 -06:00
|
|
|
endif
|
2022-11-24 10:58:36 -06:00
|
|
|
|
2023-12-26 15:39:46 -06:00
|
|
|
ifeq ($(LEAK),1)
|
|
|
|
CPPFLAGS += -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
2024-02-23 16:05:30 -06:00
|
|
|
CPPFLAGS += -DLEAK=$(LEAK)
|
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
ifeq ($(OPT),small)
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -Oz -flto -fno-ident -fno-asynchronous-unwind-tables
|
2023-09-04 21:35:05 -05:00
|
|
|
LDFLAGS += -flto
|
2023-09-05 09:38:52 -05:00
|
|
|
|
|
|
|
ifeq ($(CC), emcc)
|
|
|
|
LDFLAGS += --closure 1
|
|
|
|
endif
|
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
INFO := $(addsuffix _small,$(INFO))
|
2023-09-04 09:48:44 -05:00
|
|
|
else
|
2023-09-04 16:27:30 -05:00
|
|
|
ifeq ($(OPT), 1)
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -O2 -flto
|
2023-09-04 16:27:30 -05:00
|
|
|
INFO := $(addsuffix _opt,$(INFO))
|
|
|
|
else
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -O0
|
2023-09-04 16:27:30 -05:00
|
|
|
endif
|
2023-09-04 09:48:44 -05:00
|
|
|
endif
|
|
|
|
|
2024-02-23 16:05:30 -06:00
|
|
|
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=\"$(VER)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
|
2023-11-28 22:48:32 -06:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
CPPFLAGS += -D_FILE_OFFSET_BITS=64 # for tinycdb
|
|
|
|
|
2023-11-28 22:48:32 -06:00
|
|
|
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
|
|
|
# default, fast and medium available in game at runtime; best available in editor
|
2023-09-02 06:53:52 -05:00
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
PKGCMD = tar --directory $(BIN) --exclude="./*.a" --exclude="./obj" -czf $(DISTDIR)/$(DIST) .
|
2023-09-03 12:50:02 -05:00
|
|
|
ZIP = .tar.gz
|
2023-09-04 01:20:55 -05:00
|
|
|
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
2023-09-03 12:50:02 -05:00
|
|
|
|
2023-11-11 09:56:57 -06:00
|
|
|
ifeq ($(ARCH),)
|
|
|
|
ARCH != uname -m
|
|
|
|
endif
|
2023-09-03 12:50:02 -05:00
|
|
|
|
2023-11-20 15:57:23 -06:00
|
|
|
STEAMPATH = steam/sdk/redistributable_bin
|
2023-11-21 01:07:50 -06:00
|
|
|
DISCORDPATH = discord/lib
|
|
|
|
|
|
|
|
ifdef DISCORD
|
|
|
|
LDPATHS += $(DISCORDPATH)/$(ARCH)
|
|
|
|
LDLIBS += discord_game_sdk
|
|
|
|
CPPFLAGS += -DDISCORD
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef STEAM
|
|
|
|
LDLIBS += steam_api
|
|
|
|
LDPATHS += $(STEAMPATH)/$(ARCH)
|
|
|
|
endif
|
2023-11-20 15:57:23 -06:00
|
|
|
|
2023-09-02 06:53:52 -05:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2023-11-21 01:07:50 -06:00
|
|
|
LDFLAGS += -mwin32 -static
|
|
|
|
CPPFLAGS += -mwin32
|
2024-03-09 18:22:06 -06:00
|
|
|
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
|
2023-09-03 12:50:02 -05:00
|
|
|
EXT = .exe
|
2023-11-11 09:56:57 -06:00
|
|
|
ARCH := x86_64
|
2023-09-04 01:20:55 -05:00
|
|
|
PKGCMD = cd $(BIN); zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
|
2023-09-03 12:50:02 -05:00
|
|
|
ZIP = .zip
|
2023-09-04 01:20:55 -05:00
|
|
|
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
2023-09-03 12:50:02 -05:00
|
|
|
else ifeq ($(CC), emcc)
|
2023-11-11 09:56:57 -06:00
|
|
|
OS := Web
|
2024-03-05 00:11:34 -06:00
|
|
|
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread -sTOTAL_MEMORY=128MB
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -pthread
|
2023-09-04 16:27:30 -05:00
|
|
|
LDLIBS += pthread quickjs GL openal c m dl
|
2023-09-03 12:50:02 -05:00
|
|
|
EXT = .html
|
2023-11-20 15:57:23 -06:00
|
|
|
else
|
2023-09-03 12:50:02 -05:00
|
|
|
UNAME != uname -s
|
|
|
|
ifeq ($(UNAME), Linux)
|
2023-11-11 09:56:57 -06:00
|
|
|
OS := Linux
|
2023-09-04 16:27:30 -05:00
|
|
|
LDFLAGS += -pthread -rdynamic
|
|
|
|
LDLIBS += GL pthread c m dl X11 Xi Xcursor EGL asound
|
2023-09-03 12:50:02 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Darwin)
|
2023-11-11 09:56:57 -06:00
|
|
|
OS := macos
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -arch $(ARCH)
|
2024-01-14 10:24:31 -06:00
|
|
|
CFLAGS += -x objective-c
|
2023-11-21 01:07:50 -06:00
|
|
|
CXXFLAGS += -std=c++11
|
2024-01-14 10:24:31 -06:00
|
|
|
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
|
2023-09-03 12:50:02 -05:00
|
|
|
endif
|
2023-08-31 17:23:24 -05:00
|
|
|
endif
|
|
|
|
|
2023-11-11 09:56:57 -06:00
|
|
|
BIN = bin/$(OS)/$(ARCH)$(INFO)
|
2023-08-22 23:34:36 -05:00
|
|
|
|
2023-11-20 15:57:23 -06:00
|
|
|
ifdef STEAM
|
|
|
|
BIN := $(addsuffix /steam, $(BIN))
|
|
|
|
endif
|
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
OBJDIR = $(BIN)/obj
|
2022-01-20 11:16:44 -06:00
|
|
|
|
2022-02-03 09:16:22 -06:00
|
|
|
# All other sources
|
2024-03-13 17:07:34 -05:00
|
|
|
OBJS != find source/engine -type f -name '*.c' | grep -vE 'test|tool|example|fuzz|main' | grep -vE 'quickjs'
|
2024-03-09 18:22:06 -06:00
|
|
|
CPPOBJS != find source/engine -type f -name '*.cpp' | grep -vE 'test|tool|example|fuzz|main'
|
2024-03-03 16:58:59 -06:00
|
|
|
OBJS += $(CPPOBJS)
|
2023-11-20 07:49:14 -06:00
|
|
|
OBJS += $(shell find source/engine -type f -name '*.m')
|
2023-11-20 15:57:23 -06:00
|
|
|
OBJS := $(patsubst %.cpp, %.o, $(OBJS))
|
2023-09-04 16:27:30 -05:00
|
|
|
OBJS := $(patsubst %.c, %.o,$(OBJS))
|
2023-11-20 07:49:14 -06:00
|
|
|
OBJS := $(patsubst %.m, %.o, $(OBJS))
|
2023-09-04 16:27:30 -05:00
|
|
|
OBJS := $(addprefix $(BIN)/obj/, $(OBJS))
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
engineincs != find source/engine -maxdepth 1 -type d
|
2022-12-23 13:48:29 -06:00
|
|
|
includeflag != find source -type d -name include
|
2024-03-03 17:10:08 -06:00
|
|
|
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
|
2022-12-23 13:48:29 -06:00
|
|
|
includeflag := $(addprefix -I, $(includeflag))
|
2022-06-23 13:16:39 -05:00
|
|
|
|
2023-11-20 07:49:14 -06:00
|
|
|
# Adding different SDKs
|
|
|
|
ifdef STEAM
|
|
|
|
includeflag += -Isteam/sdk/public
|
2023-11-21 01:07:50 -06:00
|
|
|
CPPFLAGS += -DSTEAM
|
2023-11-20 15:57:23 -06:00
|
|
|
# BIN += /steam
|
2023-11-20 07:49:14 -06:00
|
|
|
endif
|
|
|
|
|
2024-03-11 22:23:02 -05:00
|
|
|
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
|
2022-11-24 01:54:17 -06:00
|
|
|
|
2023-09-18 21:55:37 -05:00
|
|
|
NAME = primum$(EXT)
|
2024-03-02 00:00:35 -06:00
|
|
|
SEM = 0.3.0
|
2023-08-22 07:29:53 -05:00
|
|
|
COM != fossil describe
|
2024-02-23 16:05:30 -06:00
|
|
|
VER = $(SEM)
|
2022-11-24 01:54:17 -06:00
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
LDLIBS := $(addprefix -l, $(LDLIBS))
|
2023-11-20 07:49:14 -06:00
|
|
|
LDPATHS := $(addprefix -L, $(LDPATHS))
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-09-04 16:27:30 -05:00
|
|
|
DEPENDS = $(OBJS:.o=.d)
|
2022-02-03 11:29:43 -06:00
|
|
|
-include $(DEPENDS)
|
2022-02-03 09:16:22 -06:00
|
|
|
|
2023-11-11 09:56:57 -06:00
|
|
|
DIST = yugine-$(OS)$(ARCH)$(INFO)-$(COM)$(ZIP)
|
2023-09-03 12:50:02 -05:00
|
|
|
DISTDIR = ./dist
|
2022-02-03 11:29:43 -06:00
|
|
|
|
2023-09-03 12:50:02 -05:00
|
|
|
.DEFAULT_GOAL := all
|
2024-02-21 03:45:26 -06:00
|
|
|
primum: all
|
2023-09-18 07:36:07 -05:00
|
|
|
all: $(BIN)/$(NAME)
|
2023-10-23 08:08:11 -05:00
|
|
|
cp $(BIN)/$(NAME) .
|
2022-08-12 14:03:56 -05:00
|
|
|
|
2023-09-03 12:50:02 -05:00
|
|
|
DESTDIR ?= ~/.bin
|
|
|
|
|
2023-09-18 07:36:07 -05:00
|
|
|
CDB = source/engine/thirdparty/tinycdb
|
|
|
|
|
2023-09-15 03:37:07 -05:00
|
|
|
SHADERS = $(shell ls source/shaders/*.sglsl)
|
|
|
|
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
|
|
|
|
|
2023-09-18 07:36:07 -05:00
|
|
|
install: $(BIN)/$(NAME)
|
2023-09-19 12:35:12 -05:00
|
|
|
cp -f $(BIN)/$(NAME) $(DESTDIR)
|
2022-11-23 22:44:42 -06:00
|
|
|
|
2023-09-25 08:21:02 -05:00
|
|
|
$(BIN)/$(NAME): $(BIN)/libengine.a $(BIN)/libquickjs.a
|
2022-12-15 17:30:17 -06:00
|
|
|
@echo Linking $(NAME)
|
2023-11-21 01:07:50 -06:00
|
|
|
$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L$(BIN) $(LDPATHS) $(LDLIBS) -o $@
|
2022-11-23 17:29:50 -06:00
|
|
|
@echo Finished build
|
2022-08-12 14:03:56 -05:00
|
|
|
|
2023-09-18 07:36:07 -05:00
|
|
|
$(DISTDIR)/$(DIST): $(BIN)/$(NAME)
|
2022-12-15 17:30:17 -06:00
|
|
|
@echo Creating distribution $(DIST)
|
2023-09-03 12:50:02 -05:00
|
|
|
@mkdir -p $(DISTDIR)
|
|
|
|
@$(PKGCMD)
|
2022-12-13 12:32:36 -06:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
$(BIN)/libengine.a: $(OBJS)
|
2023-09-15 03:37:07 -05:00
|
|
|
@$(AR) rcs $@ $(OBJS)
|
2023-09-04 16:27:30 -05:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
CDB_C != find $(CDB) -name *.c
|
|
|
|
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
|
|
|
|
$(CDB)/libcdb.a:
|
2023-09-18 10:45:51 -05:00
|
|
|
rm -f $(CDB)/libcdb.a
|
2024-03-09 18:22:06 -06:00
|
|
|
make -C $(CDB) libcdb.a
|
2024-03-13 16:30:55 -05:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
tools/libcdb.a: $(CDB)/libcdb.a
|
|
|
|
cp $(CDB)/libcdb.a tools
|
2023-10-23 08:08:11 -05:00
|
|
|
|
2023-11-16 09:27:04 -06:00
|
|
|
DOCOS = Sound gameobject Game Window physics Profile Time Player Mouse IO Log ColorMap sprite SpriteAnim Render Geometry
|
2023-10-23 08:08:11 -05:00
|
|
|
DOCHTML := $(addsuffix .api.html, $(DOCOS))
|
|
|
|
DOCMD := $(addsuffix .api.md, $(DOCOS))
|
|
|
|
|
|
|
|
api.md: $(DOCMD)
|
|
|
|
@(echo "# API"; cat $^) > $@
|
|
|
|
@rm $^
|
|
|
|
|
2023-10-26 11:48:02 -05:00
|
|
|
INPUT = editor DebugControls component.sprite component.polygon2d component.edge2d component.circle2d
|
2024-02-23 16:05:30 -06:00
|
|
|
|
2023-10-23 08:08:11 -05:00
|
|
|
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 $* > $@
|
|
|
|
|
2024-03-13 17:07:34 -05:00
|
|
|
QUICKJS := source/engine/thirdparty/quickjs
|
2024-03-09 18:22:06 -06:00
|
|
|
$(BIN)/libquickjs.a:
|
2024-03-13 17:07:34 -05:00
|
|
|
make -C $(QUICKJS) clean
|
|
|
|
make -C $(QUICKJS) SYSRT=$(SYSRT) TTARGET=$(TTARGET) ARCH=$(ARCH) DBG=$(DBG) OPT=$(OPT) AR=$(AR) OS=$(OS) libquickjs.a HOST_CC=$(CC) LEAK=$(LEAK)
|
2023-09-15 12:31:31 -05:00
|
|
|
@mkdir -p $(BIN)
|
2024-03-13 17:07:34 -05:00
|
|
|
cp -rf $(QUICKJS)/libquickjs.* $(BIN)
|
2022-12-13 12:32:36 -06:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
$(OBJDIR)/%.o: %.c source/engine/core.cdb.h $(SHADERS)
|
2022-01-20 11:16:44 -06:00
|
|
|
@mkdir -p $(@D)
|
2023-09-04 09:48:44 -05:00
|
|
|
@echo Making C object $@
|
2023-11-21 01:07:50 -06:00
|
|
|
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-11-20 07:49:14 -06:00
|
|
|
$(OBJDIR)/%.o: %.cpp
|
|
|
|
@mkdir -p $(@D)
|
2024-03-09 18:22:06 -06:00
|
|
|
@echo Making C++ object $@
|
2023-11-21 01:07:50 -06:00
|
|
|
@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
2023-11-20 07:49:14 -06:00
|
|
|
|
|
|
|
$(OBJDIR)/%.o: %.m
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
@echo Making Objective-C object $@
|
2023-11-21 01:07:50 -06:00
|
|
|
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
2023-11-20 07:49:14 -06:00
|
|
|
|
2023-09-15 03:37:07 -05:00
|
|
|
shaders: $(SHADERS)
|
|
|
|
@echo Making shaders
|
|
|
|
|
|
|
|
%.sglsl.h:%.sglsl
|
|
|
|
@echo Creating shader $^
|
2023-11-11 09:56:57 -06:00
|
|
|
@./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
|
2023-09-15 03:37:07 -05:00
|
|
|
|
2023-09-25 12:29:04 -05:00
|
|
|
cdb: tools/cdb.c tools/libcdb.a
|
|
|
|
cc $^ -I$(CDB) -o cdb
|
2023-09-18 07:36:07 -05:00
|
|
|
|
|
|
|
source/engine/core.cdb.h: core.cdb
|
|
|
|
xxd -i $< > $@
|
|
|
|
|
2024-02-27 10:09:15 -06:00
|
|
|
SCRIPTS := $(shell ls scripts/*.js*)
|
2023-09-18 07:36:07 -05:00
|
|
|
SCRIPT_O := $(addsuffix o, $(SCRIPTS))
|
|
|
|
CORE != (ls icons/* fonts/*)
|
|
|
|
CORE := $(CORE) $(SCRIPTS)
|
|
|
|
|
|
|
|
core.cdb: packer $(CORE)
|
|
|
|
./packer $(CORE)
|
|
|
|
chmod 644 out.cdb
|
|
|
|
mv out.cdb core.cdb
|
|
|
|
|
2023-09-25 12:29:04 -05:00
|
|
|
packer: tools/packer.c tools/libcdb.a
|
|
|
|
cc $^ -I$(CDB) -o packer
|
|
|
|
|
2024-02-27 10:09:15 -06:00
|
|
|
jsc: tools/jso.c tools/libquickjs.a
|
2023-09-25 12:29:04 -05:00
|
|
|
$(CC) $^ -lm -Iquickjs -o $@
|
2023-09-18 07:36:07 -05:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
tools/libquickjs.a: $(BIN)/libquickjs.a
|
|
|
|
cp -f $(BIN)/libquickjs.a tools
|
2023-09-18 07:36:07 -05:00
|
|
|
|
2023-09-19 12:35:12 -05:00
|
|
|
WINCC = x86_64-w64-mingw32-gcc
|
2023-10-16 09:40:43 -05:00
|
|
|
#WINCC = i686-w64-mingw32-g++
|
2023-09-19 12:35:12 -05:00
|
|
|
.PHONY: crosswin
|
2023-09-25 12:29:04 -05:00
|
|
|
crosswin:
|
2024-03-09 18:22:06 -06:00
|
|
|
make packer
|
2023-09-25 12:29:04 -05:00
|
|
|
make CC=$(WINCC) OS=Windows_NT
|
2023-09-19 12:35:12 -05:00
|
|
|
|
2023-11-11 09:56:57 -06:00
|
|
|
crossmac:
|
|
|
|
make ARCH=arm64
|
|
|
|
mv primum primum_arm64
|
|
|
|
make ARCH=x86_64
|
|
|
|
mv primum primum_x86_64
|
|
|
|
lipo primum_arm64 primum_x86_64 -create -output primum
|
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
crossweb:
|
|
|
|
make packer
|
|
|
|
make CC=emcc
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
clean:
|
|
|
|
@echo Cleaning project
|
2024-03-09 18:22:06 -06:00
|
|
|
rm -rf bin dist
|
|
|
|
rm -f source/shaders/*.h core.cdb jso cdb packer TAGS source/engine/core.cdb.h tools/libcdb.a $(CDB)/libcdb.a
|
|
|
|
rm -f $(CDB)/*.o
|
2024-03-13 17:07:34 -05:00
|
|
|
@make -C $(QUICKJS) clean
|
2023-09-15 03:37:07 -05:00
|
|
|
|
2024-02-21 03:45:26 -06:00
|
|
|
docs: doc/prosperon.org
|
|
|
|
make -C doc
|
|
|
|
mv doc/html .
|
2024-02-19 20:31:26 -06:00
|
|
|
|
2024-03-09 18:22:06 -06:00
|
|
|
test:
|
|
|
|
@echo No tests yet ...
|
|
|
|
|
2023-09-15 03:37:07 -05:00
|
|
|
TAGINC != find . -name "*.[chj]"
|
|
|
|
tags: $(TAGINC)
|
|
|
|
@echo Making tags.
|
|
|
|
@etags $(TAGINC)
|