|
|
|
@ -21,7 +21,7 @@
@@ -21,7 +21,7 @@
|
|
|
|
|
#
|
|
|
|
|
#**************************************************************************************************
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean |
|
|
|
|
.PHONY: all clean run |
|
|
|
|
|
|
|
|
|
# Define required environment variables
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
@ -29,11 +29,11 @@
@@ -29,11 +29,11 @@
|
|
|
|
|
PLATFORM ?= PLATFORM_DESKTOP
|
|
|
|
|
|
|
|
|
|
# Define project variables
|
|
|
|
|
PROJECT_NAME ?= raylib_game
|
|
|
|
|
PROJECT_NAME ?= lemonade-stand
|
|
|
|
|
PROJECT_VERSION ?= 1.0
|
|
|
|
|
PROJECT_BUILD_PATH ?= .
|
|
|
|
|
|
|
|
|
|
RAYLIB_PATH ?= ../../raylib
|
|
|
|
|
RAYLIB_PATH ?= ./lib/raylib
|
|
|
|
|
|
|
|
|
|
# Locations of raylib.h and libraylib.a/libraylib.so
|
|
|
|
|
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
|
|
|
@ -52,11 +52,15 @@ USE_WAYLAND_DISPLAY ?= FALSE
@@ -52,11 +52,15 @@ USE_WAYLAND_DISPLAY ?= FALSE
|
|
|
|
|
|
|
|
|
|
# PLATFORM_WEB: Default properties
|
|
|
|
|
BUILD_WEB_ASYNCIFY ?= FALSE
|
|
|
|
|
BUILD_WEB_SHELL ?= minshell.html
|
|
|
|
|
BUILD_WEB_SHELL ?= src/minshell.html
|
|
|
|
|
BUILD_WEB_HEAP_SIZE ?= 134217728
|
|
|
|
|
BUILD_WEB_RESOURCES ?= TRUE
|
|
|
|
|
BUILD_WEB_RESOURCES_PATH ?= resources
|
|
|
|
|
|
|
|
|
|
BUILD_DIR ?= ./build
|
|
|
|
|
SRC_DIR ?= ./src
|
|
|
|
|
LIB_DIR ?= ./lib
|
|
|
|
|
|
|
|
|
|
# Use cross-compiler for PLATFORM_RPI
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
|
USE_RPI_CROSS_COMPILER ?= FALSE
|
|
|
|
@ -112,7 +116,7 @@ endif
@@ -112,7 +116,7 @@ endif
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
|
ifeq ($(PLATFORM_OS),LINUX)
|
|
|
|
|
RAYLIB_PREFIX ?= ..
|
|
|
|
|
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
|
|
|
|
|
RAYLIB_PATH ?= $(realpath $(RAYLIB_PREFIX))
|
|
|
|
|
endif
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
@ -127,14 +131,16 @@ endif
@@ -127,14 +131,16 @@ endif
|
|
|
|
|
# Define raylib release directory for compiled library
|
|
|
|
|
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
|
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
|
# Emscripten required variables
|
|
|
|
|
EMSDK_PATH ?= C:/emsdk
|
|
|
|
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
|
|
|
|
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
|
|
|
|
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
|
|
|
|
|
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
|
|
|
|
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
|
|
|
|
ifeq ($(OS),Windows_NT) |
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
|
|
|
|
# Emscripten required variables
|
|
|
|
|
EMSDK_PATH ?= C:/emsdk
|
|
|
|
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
|
|
|
|
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
|
|
|
|
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
|
|
|
|
|
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
|
|
|
|
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
|
|
|
|
endif
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
# Define default C compiler: CC
|
|
|
|
@ -228,7 +234,7 @@ endif
@@ -228,7 +234,7 @@ endif
|
|
|
|
|
# Define include paths for required headers: INCLUDE_PATHS
|
|
|
|
|
# NOTE: Some external/extras libraries could be required (stb, physac, easings...)
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
|
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
|
|
|
|
|
INCLUDE_PATHS = -I$(SRC_DIR) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
|
|
|
|
|
|
|
|
|
|
# Define additional directories containing required header files
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
@ -250,7 +256,7 @@ endif
@@ -250,7 +256,7 @@ endif
|
|
|
|
|
|
|
|
|
|
# Define library paths containing required libs: LDFLAGS
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
|
|
|
|
LDFLAGS = -L$(SRC) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
|
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
|
|
@ -381,7 +387,9 @@ PROJECT_SOURCE_FILES ?= \
@@ -381,7 +387,9 @@ PROJECT_SOURCE_FILES ?= \
|
|
|
|
|
screen_ending.c
|
|
|
|
|
|
|
|
|
|
# Define all object files from source files
|
|
|
|
|
OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES))
|
|
|
|
|
OBJS = $(addprefix $(BUILD_DIR)/,$(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES)))
|
|
|
|
|
#
|
|
|
|
|
SOURCE_FILES = $(addprefix $(SRC_DIR)/,$(PROJECT_SOURCE_FILES))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define processes to execute
|
|
|
|
@ -392,21 +400,22 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
@@ -392,21 +400,22 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
|
|
|
|
export PROJECT_NAME
|
|
|
|
|
export PROJECT_SOURCE_FILES
|
|
|
|
|
else |
|
|
|
|
MAKEFILE_PARAMS = $(PROJECT_NAME)
|
|
|
|
|
MAKEFILE_PARAMS = $(BUILD_DIR)/$(PROJECT_NAME)
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
# Default target entry
|
|
|
|
|
# NOTE: We call this Makefile target or Makefile.Android target
|
|
|
|
|
all: |
|
|
|
|
$(MAKE) -C $(RAYLIB_PATH)/src $(RAYLIB PLATFORM=$(PLATFORM) -B
|
|
|
|
|
$(MAKE) $(MAKEFILE_PARAMS)
|
|
|
|
|
|
|
|
|
|
# Project target defined by PROJECT_NAME
|
|
|
|
|
$(PROJECT_NAME): $(OBJS) |
|
|
|
|
$(CC) -o $(PROJECT_NAME)$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
|
|
|
|
$(BUILD_DIR)/$(PROJECT_NAME): $(OBJS) |
|
|
|
|
$(CC) -o $@$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
|
|
|
|
|
|
|
|
|
# Compile source files
|
|
|
|
|
# NOTE: This pattern will compile every module defined on $(OBJS)
|
|
|
|
|
%.o: %.c |
|
|
|
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c |
|
|
|
|
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
|
|
|
|
|
|
|
|
|
|
# Clean everything
|
|
|
|
@ -434,3 +443,11 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
@@ -434,3 +443,11 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
|
|
|
|
endif |
|
|
|
|
@echo Cleaning done
|
|
|
|
|
|
|
|
|
|
run: $(BUILD_DIR)/$(PROJECT_NAME)$(EXT) |
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
|
./$(BUILD_DIR)/$(PROJECT_NAME)
|
|
|
|
|
endif |
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
|
npx live-server --open=$(BUILD_DIR)/$(PROJECT_NAME)$(EXT) \
|
|
|
|
|
--watch=$(BUILD_DIR)/*.wasm,$(BUILD_DIR)/*.html,$(BUILD_DIR)/*.js,$(BUILD_DIR)/*.data
|
|
|
|
|
endif |