Compile with tcc

This commit is contained in:
John Alanbrook 2022-06-23 04:04:35 +00:00
parent aa7d36b7d3
commit e6ca94c2df
2 changed files with 10 additions and 7 deletions

View file

@ -10,7 +10,9 @@ endif
UNAME_P != uname -m UNAME_P != uname -m
#CC specifies which compiler we're using #CC specifies which compiler we're using
CC = musl-clang -std=c99 CC = tcc -std=c99
MUSL = /usr/local/musl/include
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
DEFFALGS += -DDEBUG DEFFALGS += -DDEBUG
@ -78,7 +80,7 @@ WARNING_FLAGS = #-Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused
#COMPILER_FLAGS = $(includeflag) -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c -MMD -MP $< -o $@ #COMPILER_FLAGS = $(includeflag) -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c -MMD -MP $< -o $@
COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c $< -o $@ COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c $< -o $@
LIBPATH = -L./bin LIBPATH = -L./bin -L/usr/local/lib -L/usr/local/lib/tcc
ifeq ($(UNAME), Windows_NT) ifeq ($(UNAME), Windows_NT)
LINKER_FLAGS = -static -DSDL_MAIN_HANDLED LINKER_FLAGS = -static -DSDL_MAIN_HANDLED
@ -87,17 +89,17 @@ ifeq ($(UNAME), Windows_NT)
CLIBS = glew32 CLIBS = glew32
EXT = .exe EXT = .exe
else else
LINKER_FLAGS = LINKER_FLAGS = -fPIC -rdynamic
ELIBS = editor engine glfw3 m pthread ELIBS = editor engine glfw3 m c tcc tcc1
CLIBS = CLIBS =
EXT = EXT =
endif endif
ELIBS != $(call prefix, $(ELIBS), -l) ELIBS != $(call prefix, $(ELIBS), -l)
CLIBS != $(call prefix, $(CLIBS), -l) #CLIBS != $(call prefix, $(CLIBS), -l)
#LELIBS = -Wl,-Bstatic $(ELIBS)# -Wl,-Bdynamic $(CLIBS) #LELIBS = -Wl,-Bstatic $(ELIBS)# -Wl,-Bdynamic $(CLIBS)
LELIBS = $(ELIBS) #$(CLIBS) LELIBS = $(ELIBS) $(CLIBS)
objects = $(bsobjects) $(eobjects) $(pinobjects) objects = $(bsobjects) $(eobjects) $(pinobjects)
DEPENDS = $(objects:.o=.d) DEPENDS = $(objects:.o=.d)

View file

@ -40,11 +40,12 @@ void error_callback(int error, const char *description)
void engine_init() void engine_init()
{ {
glfwSetErrorCallback(error_callback);
/* Initialize GLFW */ /* Initialize GLFW */
if (!glfwInit()) { if (!glfwInit()) {
printf("Could not init GLFW\n"); printf("Could not init GLFW\n");
} }
glfwSetErrorCallback(error_callback);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);