Makefile stores results in build folder instead, general tidyup

This commit is contained in:
UnknownShadow200 2024-03-25 18:02:14 +11:00
parent d9e2ec9ad9
commit e06f54e61b

View file

@ -1,5 +1,8 @@
C_SOURCES:=$(wildcard src/*.c)
C_OBJECTS:=$(patsubst %.c, %.o, $(C_SOURCES))
SOURCE_DIR := src
BUILD_DIR := build
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
OBJECTS := $(C_OBJECTS)
ENAME = ClassiCube
DEL = rm -f
@ -18,7 +21,7 @@ ifeq ($(PLAT),web)
CC = emcc
OEXT = .html
CFLAGS = -g
LDFLAGS=-s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library src/interop_web.js
LDFLAGS = -s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library $(SOURCE_DIR)/interop_web.js
endif
ifeq ($(PLAT),mingw)
@ -39,7 +42,7 @@ LIBS=-lsocket -lX11 -lXi -lGL
endif
ifeq ($(PLAT),darwin)
OBJECTS+=src/interop_cocoa.o
OBJECTS += $(BUILD_DIR)/interop_cocoa.o
CFLAGS = -g -pipe -fno-math-errno
LIBS =
LDFLAGS = -rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
@ -70,14 +73,14 @@ LIBS=-lexecinfo -lGL -lX11 -lXi -lpthread
endif
ifeq ($(PLAT),haiku)
OBJECTS+=src/interop_BeOS.o
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe -fno-math-errno
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
endif
ifeq ($(PLAT),beos)
OBJECTS+=src/interop_BeOS.o
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
@ -159,14 +162,16 @@ ds:
clean:
$(DEL) $(OBJECTS)
$(ENAME): $(OBJECTS)
$(ENAME): $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@$(OEXT) $(OBJECTS) $(LIBS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(C_OBJECTS): %.o : %.c
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
src/interop_cocoa.o: src/interop_cocoa.m
$(BUILD_DIR)/interop_cocoa.o: $(SOURCE_DIR)/interop_cocoa.m
$(CC) $(CFLAGS) -c $< -o $@
src/interop_BeOS.o: src/interop_BeOS.cpp
$(BUILD_DIR)/interop_BeOS.o: $(SOURCE_DIR)/interop_BeOS.cpp
$(CC) $(CFLAGS) -c $< -o $@