Makefile clean-up. This is actually the first batch of changes related
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 9 Sep 2007 01:14:53 +0000 (01:14 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 9 Sep 2007 01:14:53 +0000 (01:14 +0000)
to the optional I18N stuff (ticket #114), but I somehow ended up
reorganising the whole file.

Makefile.mingw has been merged with the main Makefile.  Use "cross-make
MINGW=1".

git-svn-id: https://s.snth.net/svn/neverball/trunk@1111 78b8d119-cf0a-0410-b17c-f493084dd1d7

Makefile
Makefile.mingw [deleted file]
scripts/version.sh
tools/src/democonv.c

index 445ed61..55b0eda 100644 (file)
--- a/Makefile
+++ b/Makefile
-
 #-------------------------------------------------------------------------------
 
-#VERSION=1.5.0
-VERSION= $(shell sh scripts/version.sh)
-
+VERSION := $(shell sh scripts/version.sh)
 ifeq ($(VERSION),)
     $(error Failed to obtain version for this build)
 endif
 
 #------------------------------------------------------------------------------
 
-# Maybe you need one of these.  Maybe you don't.
+# Optional flags
+CFLAGS := -Wall -g -ansi -pedantic
 
-#X11_PATH= -L/usr/X11/lib
-#X11_PATH= -L/usr/X11R6/lib
+# Mandatory flags
+SDL_CPPFLAGS := $(shell sdl-config --cflags)
+PNG_CPPFLAGS := $(shell libpng-config --cflags)
 
-OGL_LIBS= -lGL -lm
-#OGL_LIBS= -lm                                                # Think Different
+ALL_CFLAGS   := $(CFLAGS)
+ALL_CPPFLAGS := $(SDL_CPPFLAGS) $(PNG_CPPFLAGS) -Ishare \
+    -DVERSION=\"$(VERSION)\" $(CPPFLAGS)
 
-CFLAGS += -Wall -g -O3 -ansi -pedantic
-#CFLAGS += -Wall -g -O1 -ansi -pedantic
-#CFLAGS += -Wall -pg -ansi
+#------------------------------------------------------------------------------
 
-CPPFLAGS += $(shell sdl-config --cflags) -DVERSION=\"$(VERSION)\" -Ishare
+SDL_LIBS := $(shell sdl-config --libs)
+PNG_LIBS := $(shell libpng-config --libs)
+
+ifdef MINGW
+    OGL_LIBS  := -lopengl32 -lm
+    BASE_LIBS := -lSDL -lSDL_image -lintl
+    ALL_LIBS  := $(SDL_LIBS) -lSDL_image -lintl \
+       $(PNG_LIBS) -lSDL_ttf -lSDL_mixer $(OGL_LIBS)
+else
+    OGL_LIBS  := -lGL -lm
+    BASE_LIBS := $(SDL_LIBS) -lSDL_image
+    ALL_LIBS  := $(BASE_LIBS) $(PNG_LIBS) -lSDL_ttf -lSDL_mixer $(OGL_LIBS)
+endif
 
-SDL_LIBS= $(shell sdl-config --libs)
-PNG_LIBS= $(shell libpng-config --libs)
+#------------------------------------------------------------------------------
 
-MAPC_TARG= mapc$(EXT)
-BALL_TARG= neverball$(EXT)
-PUTT_TARG= neverputt$(EXT)
+ifdef MINGW
+    EXT  := .exe
+    WINE := wine
+endif
 
-LOCALEDIR= locale
-LOCALEDOM= neverball
+#------------------------------------------------------------------------------
 
-POTFILE= po/neverball.pot
+MAPC_TARG := mapc$(EXT)
+BALL_TARG := neverball$(EXT)
+PUTT_TARG := neverputt$(EXT)
+
+#------------------------------------------------------------------------------
+
+LOCALEDIR   := locale
+LOCALEDOM   := neverball
+POTFILE     := po/neverball.pot
+MESSAGEPART := /LC_MESSAGES/$(LOCALEDOM).mo
+LINGUAS     := $(POS:po/%.po=%)
+MESSAGES    := $(LINGUAS:%=$(LOCALEDIR)/%$(MESSAGEPART))
+POS         := $(shell echo po/*.po)
 
 #-------------------------------------------------------------------------------
 
-MAPC_OBJS= \
-       share/vec3.o   \
+MAPC_OBJS := \
+       share/vec3.o        \
        share/base_image.o  \
-       share/solid.o  \
-       share/binary.o \
+       share/solid.o       \
+       share/binary.o      \
        share/base_config.o \
        share/mapc.o
-BALL_OBJS= \
-       share/lang.o    \
-       share/st_resol.o \
-       share/vec3.o    \
-       share/base_image.o   \
-       share/image.o   \
-       share/solid.o   \
-       share/solid_gl.o\
-       share/part.o    \
-       share/back.o    \
-       share/geom.o    \
-       share/gui.o     \
-       share/base_config.o  \
-       share/config.o  \
-       share/binary.o  \
-       share/state.o   \
-       share/audio.o   \
-       ball/hud.o      \
-       ball/game.o     \
-       ball/level.o    \
-       ball/levels.o   \
-       ball/set.o      \
-       ball/demo.o     \
-       ball/util.o     \
-       ball/st_conf.o  \
-       ball/st_demo.o  \
-       ball/st_save.o  \
+BALL_OBJS := \
+       share/lang.o        \
+       share/st_resol.o    \
+       share/vec3.o        \
+       share/base_image.o  \
+       share/image.o       \
+       share/solid.o       \
+       share/solid_gl.o    \
+       share/part.o        \
+       share/back.o        \
+       share/geom.o        \
+       share/gui.o         \
+       share/base_config.o \
+       share/config.o      \
+       share/binary.o      \
+       share/state.o       \
+       share/audio.o       \
+       ball/hud.o          \
+       ball/game.o         \
+       ball/level.o        \
+       ball/levels.o       \
+       ball/set.o          \
+       ball/demo.o         \
+       ball/util.o         \
+       ball/st_conf.o      \
+       ball/st_demo.o      \
+       ball/st_save.o      \
        ball/st_play_end.o  \
-       ball/st_done.o  \
-       ball/st_level.o \
-       ball/st_over.o  \
-       ball/st_play.o  \
-       ball/st_set.o   \
-       ball/st_start.o \
-       ball/st_title.o \
-       ball/st_help.o  \
-       ball/st_name.o  \
-       ball/st_shared.o  \
-       ball/st_pause.o \
+       ball/st_done.o      \
+       ball/st_level.o     \
+       ball/st_over.o      \
+       ball/st_play.o      \
+       ball/st_set.o       \
+       ball/st_start.o     \
+       ball/st_title.o     \
+       ball/st_help.o      \
+       ball/st_name.o      \
+       ball/st_shared.o    \
+       ball/st_pause.o     \
        ball/main.o
 PUTT_OBJS= \
-       share/lang.o    \
-       share/st_resol.o \
-       share/vec3.o   \
+       share/lang.o        \
+       share/st_resol.o    \
+       share/vec3.o        \
        share/base_image.o  \
-       share/image.o  \
-       share/solid.o  \
-       share/solid_gl.o  \
-       share/part.o   \
-       share/geom.o   \
-       share/back.o   \
-       share/base_config.o  \
-       share/config.o \
-       share/binary.o \
-       share/audio.o  \
-       share/state.o  \
-       share/gui.o    \
-       putt/hud.o     \
-       putt/game.o    \
-       putt/hole.o    \
-       putt/course.o  \
-       putt/st_all.o  \
-       putt/st_conf.o \
+       share/image.o       \
+       share/solid.o       \
+       share/solid_gl.o    \
+       share/part.o        \
+       share/geom.o        \
+       share/back.o        \
+       share/base_config.o \
+       share/config.o      \
+       share/binary.o      \
+       share/audio.o       \
+       share/state.o       \
+       share/gui.o         \
+       putt/hud.o          \
+       putt/game.o         \
+       putt/hole.o         \
+       putt/course.o       \
+       putt/st_all.o       \
+       putt/st_conf.o      \
        putt/main.o
 
-BALL_DEPS= $(BALL_OBJS:.o=.d)
-PUTT_DEPS= $(PUTT_OBJS:.o=.d)
-MAPC_DEPS= $(MAPC_OBJS:.o=.d)
+BALL_DEPS := $(BALL_OBJS:.o=.d)
+PUTT_DEPS := $(PUTT_OBJS:.o=.d)
+MAPC_DEPS := $(MAPC_OBJS:.o=.d)
 
-BASE_LIBS= $(SDL_LIBS) -lSDL_image
-LIBS= $(X11_PATH) $(BASE_LIBS) $(PNG_LIBS) -lSDL_ttf -lSDL_mixer $(OGL_LIBS)
+MAPS := $(shell find data -name "*.map")
+SOLS := $(MAPS:%.map=%.sol)
 
-MESSAGEPART= /LC_MESSAGES/$(LOCALEDOM).mo
-MESSAGES= $(LINGUAS:%=$(LOCALEDIR)/%$(MESSAGEPART))
-
-MAPS= $(shell find data/ -name '*.map')
-SOLS= $(MAPS:%.map=%.sol)
-
-POS= $(shell echo po/*.po)
-LINGUAS= $(POS:po/%.po=%)
-
-#------------------------------------------------------------------------------
-# Implicit rules
 #------------------------------------------------------------------------------
 
 %.d : %.c
-       $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MF $@ -MT '$*.o $@' $<
+       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -MM -MF $@ -MT '$*.o $@' $<
 
 %.o : %.c
-       $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -o $@ -c $<
 
 %.sol : %.map $(MAPC_TARG)
        $(WINE) ./$(MAPC_TARG) $< data
@@ -144,41 +154,34 @@ $(LOCALEDIR)/%$(MESSAGEPART) : po/%.po
        msgfmt -c -v -o $@ $<
 
 #------------------------------------------------------------------------------
-# Main rules
-#------------------------------------------------------------------------------
 
 all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales
 
 $(BALL_TARG) : $(BALL_OBJS)
-       $(CC) $(CFLAGS) -o $(BALL_TARG) $(BALL_OBJS) $(LDFLAGS) $(LIBS)
+       $(CC) $(ALL_CFLAGS) -o $(BALL_TARG) $(BALL_OBJS) $(LDFLAGS) $(ALL_LIBS)
 
 $(PUTT_TARG) : $(PUTT_OBJS)
-       $(CC) $(CFLAGS) -o $(PUTT_TARG) $(PUTT_OBJS) $(LDFLAGS) $(LIBS)
+       $(CC) $(ALL_CFLAGS) -o $(PUTT_TARG) $(PUTT_OBJS) $(LDFLAGS) $(ALL_LIBS)
 
 $(MAPC_TARG) : $(MAPC_OBJS)
-       $(CC) $(CFLAGS) -o $(MAPC_TARG) $(MAPC_OBJS) $(LDFLAGS) $(BASE_LIBS)
+       $(CC) $(ALL_CFLAGS) -o $(MAPC_TARG) $(MAPC_OBJS) $(LDFLAGS) $(BASE_LIBS)
 
 sols : $(SOLS)
 
 locales : $(MESSAGES)
 
 clean-src :
-       rm -f $(BALL_TARG) $(BALL_OBJS) $(BALL_DEPS)
-       rm -f $(PUTT_TARG) $(PUTT_OBJS) $(PUTT_DEPS)
-       rm -f $(MAPC_TARG) $(MAPC_OBJS) $(MAPC_DEPS)
+       $(RM) $(BALL_TARG) $(BALL_OBJS) $(BALL_DEPS)
+       $(RM) $(PUTT_TARG) $(PUTT_OBJS) $(PUTT_DEPS)
+       $(RM) $(MAPC_TARG) $(MAPC_OBJS) $(MAPC_DEPS)
 
 clean : clean-src
-       rm -f $(SOLS)
+       $(RM) $(SOLS)
        rm -rf $(LOCALEDIR)
 
 test : all
        ./neverball
 
-mingw-%:
-       $(MAKE) -f Makefile.mingw $*
-
-#------------------------------------------------------------------------------
-# PO update rules
 #------------------------------------------------------------------------------
 
 po/%.po : $(POTFILE)
@@ -196,6 +199,86 @@ po-update : po-update-extract po-update-merge
 
 .PHONY : all sols locales clean-src clean test \
        po-update-extract po-update-merge po-update \
-       tools
+
 
 -include $(BALL_DEPS) $(PUTT_DEPS) $(MAPC_DEPS)
+
+#------------------------------------------------------------------------------
+
+ifdef MINGW
+
+#------------------------------------------------------------------------------
+
+INSTALLER := ../neverball-$(VERSION)-setup.exe
+
+MAKENSIS := makensis
+MAKENSIS_FLAGS := -DVERSION=$(VERSION) -DOUTFILE=$(INSTALLER)
+
+TODOS   := todos
+FROMDOS := fromdos
+
+CP := cp
+
+TEXT_DOCS := \
+       doc/AUTHORS \
+       doc/MANUAL  \
+       CHANGES     \
+       COPYING     \
+       README
+
+TXT_DOCS := $(TEXT_DOCS:%=%.txt)
+
+#-----------------------------------------------------------------------------
+
+.PHONY: setup
+setup: $(INSTALLER)
+
+$(INSTALLER): install-dlls convert-text-files all tools
+       $(MAKENSIS) $(MAKENSIS_FLAGS) -nocd scripts/neverball.nsi
+
+$(INSTALLER): LDFLAGS := -s $(LDFLAGS)
+
+.PHONY: clean-setup
+clean-setup: clean
+       $(RM) install-dlls.sh *.dll $(TXT_DOCS)
+       find data -name "*.txt" -exec $(FROMDOS) {} \;
+       $(MAKE) -C tools EXT=$(EXT) clean
+
+#-----------------------------------------------------------------------------
+
+.PHONY: install-dlls
+install-dlls: install-dlls.sh
+       sh $<
+
+install-dlls.sh:
+       if ! sh scripts/gen-install-dlls.sh > $@; then \
+           $(RM) $@; \
+           exit 1; \
+       fi
+       @echo --------------------------------------------------------
+       @echo You can probably ignore any file-not-found errors above.
+       @echo Now edit $@ to your needs before restarting make.
+       @echo --------------------------------------------------------
+       @exit 1
+
+#-----------------------------------------------------------------------------
+
+.PHONY: convert-text-files
+convert-text-files: $(TXT_DOCS)
+       find data -name "*.txt" -exec $(TODOS) {} \;
+
+%.txt: %
+       $(CP) $< $@
+       $(TODOS) $@
+
+#-----------------------------------------------------------------------------
+
+.PHONY: tools
+tools:
+       $(MAKE) -C tools EXT=$(EXT)
+
+#------------------------------------------------------------------------------
+
+endif
+
+#------------------------------------------------------------------------------
diff --git a/Makefile.mingw b/Makefile.mingw
deleted file mode 100644 (file)
index 90147a2..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-export EXT= .exe
-
-#-----------------------------------------------------------------------------
-
-include Makefile
-
-#-----------------------------------------------------------------------------
-
-WINE= wine
-
-OGL_LIBS= -lm -lopengl32
-BASE_LIBS= -lSDL -lSDL_image -lintl
-
-LIBS= \
-       $(SDL_LIBS) -lSDL_image -lSDL_mixer -lSDL_ttf \
-       $(OGL_LIBS) $(PNG_LIBS) -lintl
-
-#-----------------------------------------------------------------------------
-
-INSTALLER= ../neverball-$(VERSION)-setup.exe
-
-MAKENSIS= makensis
-MAKENSIS_FLAGS= -DVERSION=$(VERSION) -DOUTFILE=$(INSTALLER)
-
-TODOS= todos
-FROMDOS= fromdos
-CP= cp
-
-TEXT_DOCS= \
-       doc/AUTHORS \
-       doc/MANUAL  \
-       CHANGES     \
-       COPYING     \
-       README
-
-TXT_DOCS= $(TEXT_DOCS:%=%.txt)
-
-#-----------------------------------------------------------------------------
-
-.PHONY: setup
-setup: $(INSTALLER)
-
-$(INSTALLER): install-dlls convert-text-files all tools
-       $(MAKENSIS) $(MAKENSIS_FLAGS) -nocd scripts/neverball.nsi
-
-$(INSTALLER): LDFLAGS := -s $(LDFLAGS)
-
-.PHONY: clean-setup
-clean-setup: clean
-       $(RM) install-dlls.sh *.dll $(TXT_DOCS)
-       find data -name "*.txt" -exec $(FROMDOS) {} \;
-       cd tools && $(MAKE) clean
-
-#-----------------------------------------------------------------------------
-
-.PHONY: install-dlls
-install-dlls: install-dlls.sh
-       sh $<
-
-install-dlls.sh:
-       if ! sh scripts/gen-install-dlls.sh > $@; then \
-           $(RM) $@; \
-           exit 1; \
-       fi
-       @echo --------------------------------------------------------
-       @echo You can probably ignore any file-not-found errors above.
-       @echo Now edit $@ to your needs before restarting make.
-       @echo --------------------------------------------------------
-       @exit 1
-
-#-----------------------------------------------------------------------------
-
-.PHONY: convert-text-files
-convert-text-files: $(TXT_DOCS)
-       find data -name "*.txt" -exec $(TODOS) {} \;
-
-%.txt: %
-       $(CP) $< $@
-       $(TODOS) $@
-
-#-----------------------------------------------------------------------------
-
-.PHONY: tools
-tools:
-       cd tools && $(MAKE)
-
-#-----------------------------------------------------------------------------
index 1c2bf29..e65e73b 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-rev=$(svnversion . /svn/neverball/trunk)
+rev=$(svnversion . /svn/neverball/trunk | tr : +)
 test -n "$rev" && test "$rev" != "exported" && echo "dev-r${rev}"
 
index 2cb69f7..955692a 100644 (file)
@@ -32,7 +32,7 @@
 #include <SDL_endian.h>
 
 /* HACK:  prevent including i18n. */
-#define LANGUAGE_H
+#define LANG_H
 
 #include "base_config.h"
 #include "binary.h"