Make write routines take ints, floats and shorts by value not by address
[neverball] / Makefile
index c339d5d..88b367c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,40 @@
 
 #------------------------------------------------------------------------------
 
-VERSION := $(shell sh scripts/version.sh)
-ifeq ($(VERSION),unknown)
-    $(warning Failed to obtain sane version for this build.)
+BUILD := $(shell head -n1 BUILD 2> /dev/null || echo release)
+
+ifeq ($(BUILD),release)
+    VERSION := 1.5.5
+else
+    VERSION := $(shell sh scripts/version.sh)
+    ifeq ($(VERSION),unknown)
+        VERSION := 1.5.5-dev
+    endif
 endif
 
+$(info Will make a "$(BUILD)" build of Neverball $(VERSION).)
+
+#------------------------------------------------------------------------------
 # Provide a target system hint for the Makefile.
+# Recognized PLATFORM values: darwin, mingw.
 
 ifeq ($(shell uname), Darwin)
-    DARWIN := 1
+    PLATFORM := darwin
+endif
+
+#------------------------------------------------------------------------------
+# Paths (packagers might want to set DATADIR and LOCALEDIR)
+
+USERDIR   := .neverball
+DATADIR   := ./data
+LOCALEDIR := ./locale
+
+ifeq ($(PLATFORM),mingw)
+    USERDIR := Neverball
+endif
+
+ifneq ($(BUILD),release)
+    USERDIR := $(USERDIR)-dev
 endif
 
 #------------------------------------------------------------------------------
@@ -28,17 +53,14 @@ endif
 
 # Compiler...
 
-SSE_CFLAGS := $(shell env CC="$(CC)" sh scripts/get-sse-cflags.sh)
-
-ifeq ($(ENABLE_WII),1)
+ifeq ($(ENABLE_TILT),wii)
     # -std=c99 because we need isnormal and -fms-extensions because
     # libwiimote headers make heavy use of the "unnamed fields" GCC
     # extension.
 
-    ALL_CFLAGS := -Wall -std=c99 -pedantic -fms-extensions \
-       $(SSE_CFLAGS) $(CFLAGS)
+    ALL_CFLAGS := -Wall -std=c99 -pedantic -fms-extensions $(CFLAGS)
 else
-    ALL_CFLAGS := -Wall -ansi -pedantic $(SSE_CFLAGS) $(CFLAGS)
+    ALL_CFLAGS := -Wall -ansi -pedantic $(CFLAGS)
 endif
 
 # Preprocessor...
@@ -49,17 +71,18 @@ PNG_CPPFLAGS := $(shell libpng-config --cflags)
 ALL_CPPFLAGS := $(SDL_CPPFLAGS) $(PNG_CPPFLAGS) -Ishare \
     -DVERSION=\"$(VERSION)\"
 
+ALL_CPPFLAGS += \
+    -DCONFIG_USER=\"$(USERDIR)\" \
+    -DCONFIG_DATA=\"$(DATADIR)\" \
+    -DCONFIG_LOCALE=\"$(LOCALEDIR)\"
+
 ifeq ($(ENABLE_NLS),0)
     ALL_CPPFLAGS += -DENABLE_NLS=0
 else
     ALL_CPPFLAGS += -DENABLE_NLS=1
 endif
 
-ifeq ($(ENABLE_WII),1)
-    ALL_CPPFLAGS += -DENABLE_WII=1
-endif
-
-ifdef DARWIN
+ifeq ($(PLATFORM),darwin)
     ALL_CPPFLAGS += -I/opt/local/include
 endif
 
@@ -79,13 +102,17 @@ FS_LIBS := -lphysfs
 
 INTL_LIBS :=
 
-ifeq ($(ENABLE_WII),1)
+ifeq ($(ENABLE_TILT),wii)
     TILT_LIBS := -lcwiimote -lbluetooth
+else
+ifeq ($(ENABLE_TILT),loop)
+    TILT_LIBS := -lusb-1.0 -lfreespace
+endif
 endif
 
 OGL_LIBS := -lGL -lm
 
-ifdef MINGW
+ifeq ($(PLATFORM),mingw)
     ifneq ($(ENABLE_NLS),0)
         INTL_LIBS := -lintl
     endif
@@ -94,7 +121,7 @@ ifdef MINGW
     OGL_LIBS  := -lopengl32 -lm
 endif
 
-ifdef DARWIN
+ifeq ($(PLATFORM),darwin)
     ifneq ($(ENABLE_NLS),0)
         INTL_LIBS := -lintl
     endif
@@ -105,7 +132,7 @@ endif
 
 BASE_LIBS := -ljpeg $(PNG_LIBS) $(FS_LIBS)
 
-ifdef DARWIN
+ifeq ($(PLATFORM),darwin)
     BASE_LIBS += -L/opt/local/lib
 endif
 
@@ -114,7 +141,7 @@ ALL_LIBS := $(SDL_LIBS) $(BASE_LIBS) $(TILT_LIBS) $(INTL_LIBS) -lSDL_ttf \
 
 #------------------------------------------------------------------------------
 
-ifdef MINGW
+ifeq ($(PLATFORM),mingw)
     EXT := .exe
 endif
 
@@ -122,7 +149,7 @@ MAPC_TARG := mapc$(EXT)
 BALL_TARG := neverball$(EXT)
 PUTT_TARG := neverputt$(EXT)
 
-ifdef MINGW
+ifeq ($(PLATFORM),mingw)
     MAPC := $(WINE) ./$(MAPC_TARG)
 else
     MAPC := ./$(MAPC_TARG)
@@ -152,7 +179,8 @@ BALL_OBJS := \
        share/image.o       \
        share/solid.o       \
        share/solid_gl.o    \
-       share/solid_phys.o  \
+       share/solid_cmd.o   \
+       share/solid_all.o   \
        share/part.o        \
        share/back.o        \
        share/geom.o        \
@@ -166,8 +194,6 @@ BALL_OBJS := \
        share/state.o       \
        share/audio.o       \
        share/text.o        \
-       share/sync.o        \
-       share/tilt.o        \
        share/common.o      \
        share/keynames.o    \
        share/syswm.o       \
@@ -181,11 +207,13 @@ BALL_OBJS := \
        share/fs_jpg.o      \
        share/fs_rwops.o    \
        share/fs_ov.o       \
+       share/sync.o        \
        ball/hud.o          \
        ball/game_common.o  \
        ball/game_client.o  \
        ball/game_server.o  \
        ball/game_proxy.o   \
+       ball/game_draw.o    \
        ball/score.o        \
        ball/level.o        \
        ball/progress.o     \
@@ -210,6 +238,7 @@ BALL_OBJS := \
        ball/st_name.o      \
        ball/st_shared.o    \
        ball/st_pause.o     \
+       ball/st_ball.o      \
        ball/main.o
 PUTT_OBJS := \
        share/lang.o        \
@@ -219,7 +248,8 @@ PUTT_OBJS := \
        share/image.o       \
        share/solid.o       \
        share/solid_gl.o    \
-       share/solid_phys.o  \
+       share/solid_cmd.o   \
+       share/solid_all.o   \
        share/part.o        \
        share/geom.o        \
        share/ball.o        \
@@ -232,7 +262,6 @@ PUTT_OBJS := \
        share/state.o       \
        share/gui.o         \
        share/text.o        \
-       share/sync.o        \
        share/common.o      \
        share/syswm.o       \
        share/list.o        \
@@ -243,6 +272,7 @@ PUTT_OBJS := \
        share/fs_ov.o       \
        share/dir.o         \
        share/array.o       \
+       share/sync.o        \
        putt/hud.o          \
        putt/game.o         \
        putt/hole.o         \
@@ -251,7 +281,20 @@ PUTT_OBJS := \
        putt/st_conf.o      \
        putt/main.o
 
-ifdef MINGW
+BALL_OBJS += share/solid_sim_sol.o
+PUTT_OBJS += share/solid_sim_sol.o
+
+ifeq ($(ENABLE_TILT),wii)
+BALL_OBJS += share/tilt_wii.o
+else
+ifeq ($(ENABLE_TILT),loop)
+BALL_OBJS += share/tilt_loop.o
+else
+BALL_OBJS += share/tilt_null.o
+endif
+endif
+
+ifeq ($(PLATFORM),mingw)
 BALL_OBJS += neverball.ico.o
 PUTT_OBJS += neverputt.ico.o
 endif
@@ -295,7 +338,7 @@ $(MAPC_TARG) : $(MAPC_OBJS)
 
 # Work around some extremely helpful sdl-config scripts.
 
-ifdef MINGW
+ifeq ($(PLATFORM),mingw)
 $(MAPC_TARG) : ALL_CPPFLAGS := $(ALL_CPPFLAGS) -Umain
 endif
 
@@ -333,7 +376,7 @@ TAGS :
 
 #------------------------------------------------------------------------------
 
-ifdef MINGW
+ifeq ($(PLATFORM),mingw)
 
 #------------------------------------------------------------------------------