ClassiCube/src/Makefile

138 lines
2.8 KiB
Makefile
Raw Normal View History

C_SOURCES:=$(wildcard *.c)
C_OBJECTS:=$(patsubst %.c, %.o, $(C_SOURCES))
OBJECTS:=$(C_OBJECTS)
2019-04-05 14:52:01 -04:00
ENAME=ClassiCube
DEL=rm
CFLAGS=-g -pipe -fno-math-errno
LDFLAGS=-g -rdynamic
2018-10-14 02:31:13 -04:00
2019-04-06 03:44:53 -04:00
ifndef $(PLAT)
ifeq ($(OS),Windows_NT)
PLAT=mingw
else
2019-04-06 09:16:52 -04:00
PLAT=$(shell uname -s | tr '[:upper:]' '[:lower:]')
endif
ifeq ($(PLAT),darwin)
ifeq ($(shell uname -m), x86_64)
PLAT=mac_x64
else
PLAT=mac_x32
endif
endif
2019-04-05 14:52:01 -04:00
endif
2018-10-14 02:31:13 -04:00
ifeq ($(PLAT),web)
CC=emcc
OEXT=.html
CFLAGS=-g
LDFLAGS=-s WASM=1 -s NO_EXIT_RUNTIME=1 --preload-file texpacks/default.zip@texpacks/default.zip
endif
2019-04-05 14:52:01 -04:00
ifeq ($(PLAT),mingw)
CC=gcc
OEXT=.exe
CFLAGS=-g -pipe -DUNICODE -fno-math-errno
LDFLAGS=-g
2022-08-21 06:58:12 -04:00
LIBS=-mwindows -lwinmm -limagehlp
endif
2019-04-05 14:52:01 -04:00
ifeq ($(PLAT),linux)
LIBS=-lX11 -lXi -lpthread -lGL -lm -ldl
endif
ifeq ($(PLAT),sunos)
CFLAGS=-g -pipe -fno-math-errno
LIBS=-lm -lsocket -lX11 -lXi -lGL
endif
2019-04-06 03:44:53 -04:00
ifeq ($(PLAT),mac_x32)
CFLAGS=-g -m32 -pipe -fno-math-errno
LIBS=
2021-06-04 05:35:43 -04:00
LDFLAGS=-rdynamic -framework Carbon -framework AGL -framework OpenGL -framework IOKit
endif
2019-04-06 03:44:53 -04:00
ifeq ($(PLAT),mac_x64)
OBJECTS+=interop_cocoa.o
CFLAGS=-g -m64 -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 -lm -lpthread
endif
2019-04-06 03:44:53 -04:00
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 -lm -lpthread
endif
2019-04-06 03:44:53 -04:00
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
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 -lm -lpthread
endif
2019-11-11 02:23:50 -05:00
ifeq ($(PLAT),haiku)
CFLAGS=-g -pipe -fno-math-errno
2019-11-11 02:23:50 -05:00
LDFLAGS=-g
LIBS=-lm -lexecinfo -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
2019-11-11 02:23:50 -05:00
endif
2022-10-18 06:27:16 -04:00
ifeq ($(PLAT),serenityos)
LIBS=-lgl -lSDL2
endif
ifeq ($(OS),Windows_NT)
DEL=del
endif
2019-04-05 14:52:01 -04:00
default: $(PLAT)
web:
$(MAKE) $(ENAME) PLAT=web
2019-04-05 14:52:01 -04:00
linux:
$(MAKE) $(ENAME) PLAT=linux
2019-04-05 14:52:01 -04:00
mingw:
$(MAKE) $(ENAME) PLAT=mingw
sunos:
$(MAKE) $(ENAME) PLAT=sunos
mac_x32:
$(MAKE) $(ENAME) PLAT=mac_x32
mac_x64:
$(MAKE) $(ENAME) PLAT=mac_x64
2019-04-06 03:44:53 -04:00
freebsd:
$(MAKE) $(ENAME) PLAT=freebsd
2019-04-06 03:44:53 -04:00
openbsd:
$(MAKE) $(ENAME) PLAT=openbsd
2019-04-06 03:44:53 -04:00
netbsd:
$(MAKE) $(ENAME) PLAT=netbsd
dragonfly:
$(MAKE) $(ENAME) PLAT=dragonfly
haiku:
$(MAKE) $(ENAME) PLAT=haiku
2022-10-18 06:27:16 -04:00
serenityos:
$(MAKE) $(ENAME) PLAT=serenityos
2022-10-18 06:27:16 -04:00
2018-10-14 02:31:13 -04:00
clean:
2019-04-05 14:52:01 -04:00
$(DEL) $(OBJECTS)
$(ENAME): $(OBJECTS)
$(CC) $(LDFLAGS) -o $@$(OEXT) $(OBJECTS) $(LIBS)
$(C_OBJECTS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
interop_cocoa.o: interop_cocoa.m
$(CC) $(CFLAGS) -c $< -o $@