Fixed a problem with Makefile.mingw where make wasn't rebuilding targets
[neverball] / Makefile
index b49b6f7..fbb726e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,13 @@
 
+#-------------------------------------------------------------------------------
+
+#VERSION=1.5.0
+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.
 OGL_LIBS= -lGL -lm
 #OGL_LIBS= -lm                                                # Think Different
 
-#------------------------------------------------------------------------------
-# Configuration constants
-#------------------------------------------------------------------------------
-
 CFLAGS= -Wall -g -O3 -ansi -pedantic $(shell sdl-config --cflags)
 #CFLAGS= -Wall -g -O1 -ansi -pedantic $(shell sdl-config --cflags)
 #CFLAGS= -Wall -pg -ansi $(shell sdl-config --cflags)
 
+CPPFLAGS := -DVERSION=\"$(VERSION)\" -Ishare $(CPPFLAGS)
+
 SDL_LIBS= $(shell sdl-config --libs)
+PNG_LIBS= $(shell libpng-config --libs)
 
 MAPC_TARG= mapc$(EXT)
 BALL_TARG= neverball$(EXT)
@@ -110,7 +118,7 @@ PUTT_DEPS= $(PUTT_OBJS:.o=.d)
 MAPC_DEPS= $(MAPC_OBJS:.o=.d)
 
 BASE_LIBS= $(SDL_LIBS) -lSDL_image
-LIBS= $(X11_PATH) $(BASE_LIBS) -lpng -lSDL_ttf -lSDL_mixer $(OGL_LIBS)
+LIBS= $(X11_PATH) $(BASE_LIBS) $(PNG_LIBS) -lSDL_ttf -lSDL_mixer $(OGL_LIBS)
 
 MESSAGEPART= /LC_MESSAGES/$(LOCALEDOM).mo
 MESSAGES= $(LINGUAS:%=$(LOCALEDIR)/%$(MESSAGEPART))
@@ -126,10 +134,10 @@ LINGUAS= $(POS:po/%.po=%)
 #------------------------------------------------------------------------------
 
 %.d : %.c
-       $(CC) $(CFLAGS) -Ishare -MM -MF $@ -MT '$*.o $@' $<
+       $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MF $@ -MT '$*.o $@' $<
 
 %.o : %.c
-       $(CC) $(CFLAGS) -Ishare -o $@ -c $<
+       $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
 
 %.sol : %.map $(MAPC_TARG)
        $(MAPC_EXEC) $< data
@@ -172,6 +180,9 @@ test : all
 tools :
        cd tools && $(MAKE)
 
+mingw-%:
+       $(MAKE) -f Makefile.mingw $*
+
 #------------------------------------------------------------------------------
 # PO update rules
 #------------------------------------------------------------------------------
@@ -181,7 +192,7 @@ po/%.po : $(POTFILE)
        touch $@
        
 po-update-extract :
-       bash extractpo.sh $(POTFILE) $(LOCALEDOM)
+       sh scripts/extractpo.sh $(POTFILE) $(LOCALEDOM)
 
 po-update-merge : $(POS)