aboutsummaryrefslogblamecommitdiffstats
path: root/Game/Code/Makefile.in
blob: dddcc52fc80e586d0ba01ff49c5479bff6058687 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
   
                                
                    










                            
                 
 

                    




                                                        

                    
                              


                





                                         
                        


                                 
                                      
 
                                                           



                       
                





                                    
                                    







                                                                      

                                     

                                                                        


                                                                                    
                                                                                          







                                                                
                                               

          
                   

                                                             
                         
 















                                                                    



                                        

                                            
 
                                                                                                                                                                                                                                                                        
 
                               
 
                              
 





                                                                       

                          
                               
                                                                                                            

                                
                         




                                    
 
             















                                                                                                            

               
                          
 
 
 
                       
 










































































                                                                                                                                                   
 
                 
 


                                                                                                 
                                                  
                                                           
                                                            


                              

           
                                                                                                               
                          

           
                                 
 
                                                         


                                             
                               

                                                                                            
                                                 








                                    
                                  
##
# Makefile for @PACKAGE_STRING@
# @configure_input@
##

# general definitions
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
infodir = @infodir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
datarootdir = @datarootdir@
VPATH = @srcdir@

usdxrootdir = ../..

INSTALL_PATH_SUFFIX = @suffix@
INSTALL_datadir = $(datarootdir)/$(INSTALL_PATH_SUFFIX)

# recursive dir creation tool
MKDIR_P = @MKDIR_P@
# install tool
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
# calls "ln -s"
LN_S = @LN_S@

LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

# Package configuration
USDX_PACKAGE_NAME = @PACKAGE_NAME@
# should be $(USDX_PACKAGE_NAME) instead
USDX_PREFIX = UltraStar
USDX_VERSION = @PACKAGE_VERSION@
USDX_TARNAME = @PACKAGE_TARNAME@

USDX_TOOLS_DIR = $(usdxrootdir)/Tools

# file-type suffix of executables (e.g. ".exe" in windows)
EXE_SUFFIX = @EXEEXT@

# Free Pascal compiler
PPC = @PPC@
PLIBS = @PLIBS@
# FPC target platform and processor
PPLATFORM = @FPC_PLATFORM@
PPROCESSOR = @FPC_PROCESSOR@

# lazarus defines
LAZARUS_DIR = @LAZARUS_DIR@
LCL_WIDGET_TYPE = @LCL_WIDGET_TYPE@
PROJ_SUFFIX = .lpr

# RC to LRS resource compiler
RESCOMPILER_NAME = USDXResCompiler
RESCOMPILER_BIN = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(EXE_SUFFIX)
RESCOMPILER_SRC = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(PROJ_SUFFIX)
RESCOMPILER_PFLAGS = -dRELEASE

# Directories added to the unit path
PUNIT_TOKEN = -Fu
PUNIT_FLAGS = \
    $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \
    $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \
    $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \
    $(PUNIT_TOKEN).
#    $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE)

# Directory where compiled units (.ppu and .o files) are stored
PCUNIT_TOKEN = -FU
PCUNIT_DIR = ./build/$(PPLATFORM)/lazarus
PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR)

# Directories added to the includes path
PINC_TOKEN = -Fi
PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas

# Defines
PDEFINES  = -dLCL 
# this is necessary to use lazjpeg instead of Ulazjpeg
# but requires configure to detect if gtk/gkt2 or qt is used
#-dLCL$(LCL_WIDGET_TYPE)

# FPC flags

# The user can overwrite the default flags with
#   make PFLAGS="myflags"
PFLAGS = -S2dgi
# the user's flags (specified with configure) must be the last in
# the list to overwrite the defaults (e.g.with the - option: -Xs-).
PFLAGS += @PFLAGS@

PFLAGS_DEBUG   = @PFLAGS_DEBUG@
PFLAGS_RELEASE = @PFLAGS_RELEASE@

# The user can specify additional flags with
#   make PFLAGS_EXTRA="myflags"
PFLAGS_EXTRA =
PFLAGS += $(PFLAGS_EXTRA)

# lpr project file used as input
USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX)
# name of executable
USDX_BIN_NAME = $(USDX_PREFIX)$(EXE_SUFFIX)
USDX_BIN = $(usdxrootdir)/$(USDX_BIN_NAME)

.PHONY: all resources ultrastardx-app install install-dev install-release install-data install-data-recursive install-exec uninstall uninstall-dev uninstall-release uninstall-data uninstall-exec clean distclean clean_obj clean_res fetch-sounds dist debian-package

all: resources ultrastardx-app

resources: $(USDX_PREFIX).lrs

ultrastardx-app: $(USDX_BIN)

# Clean and rebuild everything because FPC caches some old files
# (it uses an .inc-files cache for example).
# As a result FPC misses some changes if it is called without cleaning
# up first (very annoying while debugging).
$(USDX_BIN): clean_obj
#	$(MAKE) clean_obj
	mkdir -p $(PCUNIT_DIR)
	$(PPC) $(PFLAGS) $(PDEFINES) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC)

install: install-@install_type@
# depends on $(USDX_BIN)

uninstall: uninstall-@install_type@


# local development build

install-dev:
	@if [ ! -d "$(usdxrootdir)/Visuals" ]; then \
	  echo "Copying visualizer data to $(usdxrootdir)/Visuals ..."; \
	  cp -r "$(usdxrootdir)/InstallerDependencies/Visuals" "$(usdxrootdir)"; \
	fi
	@if [ ! -f "$(usdxrootdir)/Sounds/Common start.mp3" ]; then \
	  echo ""; \
	  echo "# The sound-files from Sound-directory of the 1.0.1-branch are required."; \
	  echo "# Copy them yourself to \"$(usdxrootdir)/Sounds\""; \
	  echo "# or if you are connected to the web try:"; \
	  echo "#  make fetch-sounds"; \
	fi

fetch-sounds:
	svn co https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/1.0.1/Sounds tmp-sounds
	mv tmp-sounds/*.mp3 $(usdxrootdir)/Sounds
	rm -rf tmp-sounds

uninstall-dev:
	rm -f $(USDX_BIN)



# global release build

install-release: install-data install-exec

install-data:
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Themes RECURSIVE_DST_DIR=$(INSTALL_datadir)/Themes install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Sounds RECURSIVE_DST_DIR=$(INSTALL_datadir)/Sounds install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Languages RECURSIVE_DST_DIR=$(INSTALL_datadir)/Languages install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Skins RECURSIVE_DST_DIR=$(INSTALL_datadir)/Skins install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/InstallerDependencies/Visuals RECURSIVE_DST_DIR=$(INSTALL_datadir)/Visuals install-data-recursive

install-data-recursive:
	$(MKDIR_P) $(RECURSIVE_DST_DIR)
	@for file in $(RECURSIVE_SRC_DIR)/*; do \
	  if test -f "$$file"; then \
	    $(INSTALL_DATA) "$$file" $(RECURSIVE_DST_DIR); \
	  fi; \
	  if test -d "$$file"; then \
	    subdir="$$file"; \
	    subdirname=`basename "$$subdir"`; \
	    $(MAKE) RECURSIVE_SRC_DIR="$$subdir" RECURSIVE_DST_DIR="$(RECURSIVE_DST_DIR)/$$subdirname" install-data-recursive; \
	  fi; \
	done

install-exec:
	$(MKDIR_P) $(bindir)
	$(INSTALL) $(USDX_BIN) $(bindir)

uninstall-release: uninstall-data uninstall-exec

uninstall-data:
# TODO: delete the directories created at the first execution of usdx too (like Screenshots/Playlists)
	rm -rf $(INSTALL_datadir)/Themes
	rm -rf $(INSTALL_datadir)/Sounds
	rm -rf $(INSTALL_datadir)/Languages
	rm -rf $(INSTALL_datadir)/Skins
	rm -rf $(INSTALL_datadir)/Visuals
	rmdir $(INSTALL_datadir)

uninstall-exec:
	rm -f $(bindir)/$(USDX_BIN_NAME)

disttmpdir = ./distdir

dist:
# TODO: this needs some work
#	$(MKDIR_P) $(disttmpdir)
#	acm $(usdxrootdir) $(disttmpdir)
#	$(MAKE) -C $(disttmpdir)/Game/Code distclean 
#	tar cvzf $(USDX_TARNAME)-$(USDX_VERSION).tar.gz $(usdxrootdir)
	@echo "Comming soon"


debpkgoutdir = $(usdxrootdir)/packages
debpkgtmpdir = $(debpkgoutdir)/deb-package
# should be $(USDX_PACKAGE_NAME) instead
debpkgprefix = UltraStarDeluxe
debpkgname = $(debpkgprefix)_$(USDX_VERSION)_$(PPROCESSOR).deb

debian-package: $(debpkgname)

$(debpkgname):
#$(USDX_BIN)
	rm -rf $(debpkgtmpdir)
	rm -rf $(debpkgoutdir)

	$(MKDIR_P) $(debpkgoutdir)
	$(MKDIR_P) $(debpkgtmpdir)/DEBIAN

	$(MAKE) prefix=$(debpkgtmpdir)/$(prefix) install

	$(INSTALL_DATA) $(debpkgprefix).control $(debpkgtmpdir)/DEBIAN/control

	dpkg-deb --build $(debpkgtmpdir)
	mv $(debpkgtmpdir)/../deb-package.deb $(debpkgoutdir)/$(debpkgname)

#	rm -rf $(debpkgtmpdir)

clean: clean_obj

distclean: clean clean_res
	find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f
	find . -name "*~" -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f
	find . -name "__history" | xargs rm -r -f
	rm -f $(USDX_PREFIX).res $(USDX_PREFIX).identcache
	rm -f config.inc config.log config.status configure
	rm -f Makefile
	rm -f aclocal.m4 
	rm -rf autom4te.cache

clean_obj:
	find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f
	rm -f $(USDX_BIN)

clean_res:
	rm -f $(USDX_PREFIX).lrs

$(USDX_PREFIX).lrs: $(RESCOMPILER_BIN) $(USDX_PREFIX).rc
	$(RESCOMPILER_BIN) $(USDX_PREFIX).rc

$(RESCOMPILER_BIN): $(RESCOMPILER_SRC)
	mkdir -p $(PCUNIT_DIR)
	$(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC)

configure: configure.ac config.inc.in aclocal.m4
	autoconf

aclocal.m4: m4/*
	aclocal -I m4

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck