aboutsummaryrefslogblamecommitdiffstats
path: root/Game/Code/Makefile.in
blob: fa2ba5d94bc173a5e47e930f04e0e16d6add369c (plain) (tree)











































































































                                                                        
                                                                                                                                                                                                                                                                                                                                                         





















                                                                         
                                









                                                                                                                         

                
                           










                                                         




                                                                                                                                    

                       

                                                   
                                     

                                                                   








                                                                                                                                

                                            

                                               
                                 


                                                                                                      





                                             

               
                                          















































































































                                                                                                                   
                                                              







                                                                                                              
                           

          
                                























                                                                                                                                
##
# 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 = @usdxrootdir@
logrootdir = @logrootdir@

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

@SET_MAKE@

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

# 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
USDX_LIB_DIR   = ./lib
USDX_BUILD_DIR = ./build

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

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

EXTRA_SRCDIRS =

# RC resource extraction config
RESEXTRACTOR_NAME = ResourceExtractor
RESEXTRACTOR_DIR = $(USDX_TOOLS_DIR)/$(RESEXTRACTOR_NAME)
RESEXTRACTOR_BIN = $(RESEXTRACTOR_DIR)/$(RESEXTRACTOR_NAME)$(EXE_SUFFIX)
RESOURCE_DIR = $(usdxrootdir)/Resources
RESOURCE_FILE = resource.inc
EXTRA_SRCDIRS += $(RESEXTRACTOR_DIR)

# cwrapper settings
PROJECTM_CWRAPPER_DIR = $(USDX_LIB_DIR)/projectM/cwrapper
@COMMENT_PROJECTM_CWRAPPER@EXTRA_SRCDIRS += $(PROJECTM_CWRAPPER_DIR)

# Directories added to the unit path
PUNIT_TOKEN = -Fu
PUNIT_FLAGS = $(PUNIT_TOKEN).

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

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

# FPC flags

# The user can overwrite the default flags with
#   make PFLAGS_BASE="myflags"
PFLAGS_BASE = -S2gi -vB
# The user can specify additional flags with
#   make PFLAGS_EXTRA="myflags"
PFLAGS_EXTRA = @PFLAGS_EXTRA@
PFLAGS_DEBUG   = @PFLAGS_DEBUG@
PFLAGS_RELEASE = @PFLAGS_RELEASE@
# 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_BASE) @PFLAGS_MAKE@ $(PFLAGS_EXTRA)

LIBS = @LIBS@
LDFLAGS = @LDFLAGS@
linkflags = $(strip $(LDFLAGS) $(LIBS))
ifneq ($(linkflags),)
PLINKFLAGS = -k"$(linkflags)"
endif

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

modfile = lastmod

.PHONY: debug release recursive all recursive-all dependencies install install-local install-global install-data install-data-recursive install-exec uninstall uninstall-local uninstall-global uninstall-data uninstall-exec clean recursive-clean distclean recursive-distclean clean_obj clean_res dist debian-package update-modfile $(EXTRA_SRCDIRS)

debug: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_DEBUG) $(PFLAGS_EXTRA)
debug: all

release: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_RELEASE) $(PFLAGS_EXTRA)
release: all

all: recursive-all update-modfile dependencies $(USDX_BIN)

recursive-all: recursive-target = all
recursive-all: recursive

dependencies: $(RESOURCE_FILE)

# call Makefiles in other source-dirs
recursive: $(EXTRA_SRCDIRS)
$(EXTRA_SRCDIRS):
	$(MAKE) -C $@ $(recursive-target)

# clean old data before compiling, otherwise FPC might miss some changes.
$(USDX_BIN): lastmod 
	$(MAKE) clean_obj
	mkdir -p "$(PCUNIT_DIR)"
	$(PPC) $(strip $(PFLAGS) $(PDEFINES) $(PLINKFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS)) -o$@ $(USDX_SRC)

install: all install-@install_type@

uninstall: uninstall-@install_type@


# local build

install-local:

uninstall-local:
	rm -f "$(USDX_BIN)"


# global build

install-global: install-data install-exec
# TODO: to which user/group/rights must the logdir be set
# "drwxrwxrwx" might be too dangerous
#	$(MKDIR_P) $(INSTALL_logdir)
#	chmod ??? $(INSTALL_logdir)

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)/Resources" RECURSIVE_DST_DIR="$(INSTALL_datadir)/Resources" install-data-recursive

install-data-recursive:
	$(MKDIR_P) "$(RECURSIVE_DST_DIR)"
	@for file in "$(RECURSIVE_SRC_DIR)"/*; do \
	  if test -f "$$file"; then \
	    echo $(INSTALL_DATA) "$$file" "$(RECURSIVE_DST_DIR)"; \
	    $(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-global: uninstall-data uninstall-exec
	rmdir "$(INSTALL_logdir)"

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)/Resources"
	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): all
	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)

rpm: all
#	rpm 
	@echo "Coming soon"

macosx_bundle_path = ../../UltraStarDeluxe.app/Contents
macosx-app: all 
# Create double clickable Mac OS X application.

	@echo ""
	@echo "Creating the Mac OS X application"
	@echo ""
	install -d $(macosx_bundle_path)/MacOS
	install -d $(macosx_bundle_path)/Resources

# Strip symbols and copy the binary.
	install -s ../../UltraStar	$(macosx_bundle_path)/MacOS

# Put the icon file into its particular place. 
# Must be done BEFORE info.plist is created.
	install ../../Resources/Graphics/ustar-icon_v01.icns	$(macosx_bundle_path)/Resources/

# the info.plist file
	install MacOSX/Info.plist	$(macosx_bundle_path)/

# Copy the resources. 
# This should be replaced by something like install-data and 
# install-data-recursive and an adjusted prefix or so
	install -d 				$(macosx_bundle_path)/Resources/Artwork
	install ../../Artwork/*			$(macosx_bundle_path)/Resources/Artwork
	install -d 				$(macosx_bundle_path)/Resources/Languages
	install ../../Languages/*		$(macosx_bundle_path)/Resources/Languages
	install -d 					$(macosx_bundle_path)/Resources/Resources/Fonts/Bold
	install ../../Resources/Fonts/Bold/*		$(macosx_bundle_path)/Resources/Resources/Fonts/Bold/
	install -d 					$(macosx_bundle_path)/Resources/Resources/Fonts/Normal
	install ../../Resources/Fonts/Normal/*		$(macosx_bundle_path)/Resources/Resources/Fonts/Normal/
	install -d 					$(macosx_bundle_path)/Resources/Resources/Fonts/Outline\ 1
	install ../../Resources/Fonts/Outline\ 1/*	$(macosx_bundle_path)/Resources/Resources/Fonts/Outline\ 1/
	install -d 					$(macosx_bundle_path)/Resources/Resources/Fonts/Outline\ 2
	install ../../Resources/Fonts/Outline\ 2/*	$(macosx_bundle_path)/Resources/Resources/Fonts/Outline\ 2/
	install -d 				$(macosx_bundle_path)/Resources/Resources/Graphics
	install ../../Resources/Graphics/*	$(macosx_bundle_path)/Resources/Resources/Graphics/
	install -d 				$(macosx_bundle_path)/Resources/Resources/Sounds
	install ../../Resources/Sounds/*	$(macosx_bundle_path)/Resources/Resources/Sounds/
	install -d 				$(macosx_bundle_path)/Resources/Sounds
	install ../../Sounds/*			$(macosx_bundle_path)/Resources/Sounds
	install -d 				$(macosx_bundle_path)/Resources/Themes/Classic
	install ../../Themes/Classic/*		$(macosx_bundle_path)/Resources/Themes/Classic/
	install ../../Themes/Classic.ini	$(macosx_bundle_path)/Resources/Themes
	install -d 				$(macosx_bundle_path)/Resources/Themes/Deluxe
	install ../../Themes/Deluxe/*		$(macosx_bundle_path)/Resources/Themes/Deluxe/
	install ../../Themes/Deluxe.ini		$(macosx_bundle_path)/Resources/Themes
	install ../../License.txt		$(macosx_bundle_path)/Resources/

# the empty dirs
	install -d $(macosx_bundle_path)/Resources/Covers
	install -d $(macosx_bundle_path)/Resources/Logs
	install -d $(macosx_bundle_path)/Resources/Plugins
	install -d $(macosx_bundle_path)/Resources/Screenshots
	install -d $(macosx_bundle_path)/Resources/Visuals

# final messages
	@echo ""
	@echo "Mac OS X application created."
	@echo "Please report issues to the developer team, preferably mischi."
	@echo "Have fun."
	@echo ""

clean: recursive-clean clean_obj

recursive-clean: recursive-target = clean
recursive-clean: recursive

distclean: recursive-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 Makefile config.log config.status configure aclocal.m4 
	rm -rf autom4te.cache

recursive-distclean: recursive-target = distclean
recursive-distclean: recursive

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 "$(RESOURCE_FILE)"

$(RESOURCE_FILE): $(USDX_PREFIX).rc
	$(RESEXTRACTOR_BIN) $(USDX_PREFIX).rc $(RESOURCE_DIR) $(RESOURCE_FILE)


# FPC does not recognize changes correctly. E.g. sometimes changes in .inc-files or
# conditional .pas dependencies are ignored which results in corrupted builds.
# So check for changes with a modification timestamp.
update-modfile:
	test -e $(modfile) || touch $(modfile)
	find . \( -name "*.pas" -o -name "*.pp" -o -name "*.inc" -o -name "*.dpr" \) -newer $(modfile) -exec touch $(modfile) \;
	find $(USDX_LIB_DIR) -name "*.a" -newer $(modfile) -exec touch $(modfile) \;

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

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

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

aclocal.m4: m4/*
	aclocal -I m4