mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Makefile stores results in build folder instead, general tidyup
This commit is contained in:
parent
d9e2ec9ad9
commit
e06f54e61b
1 changed files with 58 additions and 53 deletions
111
Makefile
111
Makefile
|
@ -1,99 +1,102 @@
|
|||
C_SOURCES:=$(wildcard src/*.c)
|
||||
C_OBJECTS:=$(patsubst %.c, %.o, $(C_SOURCES))
|
||||
OBJECTS:=$(C_OBJECTS)
|
||||
ENAME=ClassiCube
|
||||
DEL=rm -f
|
||||
CFLAGS=-g -pipe -fno-math-errno
|
||||
LDFLAGS=-g -rdynamic
|
||||
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
|
||||
CFLAGS = -g -pipe -fno-math-errno
|
||||
LDFLAGS = -g -rdynamic
|
||||
|
||||
ifndef $(PLAT)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
PLAT=mingw
|
||||
PLAT = mingw
|
||||
else
|
||||
PLAT=$(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
PLAT = $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
endif
|
||||
endif
|
||||
|
||||
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
|
||||
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 $(SOURCE_DIR)/interop_web.js
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),mingw)
|
||||
CC=gcc
|
||||
OEXT=.exe
|
||||
CFLAGS=-g -pipe -DUNICODE -fno-math-errno
|
||||
LDFLAGS=-g
|
||||
LIBS=-mwindows -lwinmm -limagehlp
|
||||
CC = gcc
|
||||
OEXT = .exe
|
||||
CFLAGS = -g -pipe -DUNICODE -fno-math-errno
|
||||
LDFLAGS = -g
|
||||
LIBS = -mwindows -lwinmm -limagehlp
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),linux)
|
||||
LIBS=-lX11 -lXi -lpthread -lGL -ldl
|
||||
LIBS = -lX11 -lXi -lpthread -lGL -ldl
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),sunos)
|
||||
CFLAGS=-g -pipe -fno-math-errno
|
||||
LIBS=-lsocket -lX11 -lXi -lGL
|
||||
CFLAGS = -g -pipe -fno-math-errno
|
||||
LIBS = -lsocket -lX11 -lXi -lGL
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),darwin)
|
||||
OBJECTS+=src/interop_cocoa.o
|
||||
CFLAGS=-g -pipe -fno-math-errno
|
||||
LIBS=
|
||||
LDFLAGS=-rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
|
||||
OBJECTS += $(BUILD_DIR)/interop_cocoa.o
|
||||
CFLAGS = -g -pipe -fno-math-errno
|
||||
LIBS =
|
||||
LDFLAGS = -rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),freebsd)
|
||||
CFLAGS=-g -pipe -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS=-L /usr/local/lib -rdynamic
|
||||
LIBS=-lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS = -L /usr/local/lib -rdynamic
|
||||
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),openbsd)
|
||||
CFLAGS=-g -pipe -I /usr/X11R6/include -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS=-L /usr/X11R6/lib -L /usr/local/lib -rdynamic
|
||||
LIBS=-lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
CFLAGS = -g -pipe -I /usr/X11R6/include -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS = -L /usr/X11R6/lib -L /usr/local/lib -rdynamic
|
||||
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),netbsd)
|
||||
CFLAGS=-g -pipe -I /usr/X11R7/include -I /usr/pkg/include -fno-math-errno
|
||||
LDFLAGS=-L /usr/X11R7/lib -L /usr/pkg/lib -rdynamic
|
||||
LIBS=-lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
CFLAGS = -g -pipe -I /usr/X11R7/include -I /usr/pkg/include -fno-math-errno
|
||||
LDFLAGS = -L /usr/X11R7/lib -L /usr/pkg/lib -rdynamic
|
||||
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),dragonfly)
|
||||
CFLAGS=-g -pipe -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS=-L /usr/local/lib -rdynamic
|
||||
LIBS=-lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno
|
||||
LDFLAGS = -L /usr/local/lib -rdynamic
|
||||
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),haiku)
|
||||
OBJECTS+=src/interop_BeOS.o
|
||||
CFLAGS=-g -pipe -fno-math-errno
|
||||
LDFLAGS=-g
|
||||
LIBS=-lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
|
||||
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
|
||||
CFLAGS=-g -pipe
|
||||
LDFLAGS=-g
|
||||
LIBS=-lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
|
||||
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
|
||||
CFLAGS = -g -pipe
|
||||
LDFLAGS = -g
|
||||
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),serenityos)
|
||||
LIBS=-lgl -lSDL2
|
||||
LIBS = -lgl -lSDL2
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT),irix)
|
||||
CC=gcc
|
||||
LIBS=-lGL -lX11 -lXi -lpthread -ldl
|
||||
CC = gcc
|
||||
LIBS = -lGL -lX11 -lXi -lpthread -ldl
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
DEL=del
|
||||
DEL = del
|
||||
endif
|
||||
|
||||
default: $(PLAT)
|
||||
|
@ -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 $@
|
||||
|
|
Loading…
Reference in a new issue