News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Makefile for pak128.britain[standard + ex] -- and some questions

Started by sdog, May 30, 2010, 09:34:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sdog

A few nights ago i tried to write a Makefile to build  pak128.britain standard and experimental, pulled from github. My frustration with mose.py was high enough to start this. (btw why mose at all instead of gnu make?) It worked well enough to let it run, however i've got a couple of questions:

first i'm missing a couple of files in my build (e.g. symbol.BigLogo.pak, demo.sve) are they included in the repository at all? Or do i have to look more carefully, and they're built not just directly from dirs.

does contain ground.Outside.pak all dat files of grounds dir, or only Outside.pak?

in view of possible later releases of my Makefile, how important is it to follow the naming conventions? eg. you capitalized the pak filenames, while the directories from which they are built were not. Such things can be done but it's a bit awkward in the makefile.

Why is the -Ex and .all required in the filenames? As far as i understood it this would make sense if the files would be built, for both paksets and then mixed together to assemble the paksets. But with git repositories, it's much more sense to have all sources, also those identical in both, in both branches? Please correct me if i'm wrong, it's not unlikely i completely missunderstood the workflow.

By the way, having Boats192 in Boats/192 makes it difficult to generalize, gui/gui64 is quite easy and can be well generalized in the Makefile

EDIT: changed the subject line, to let me accomodate the release of the files in this thread
EDIT: changed topic to make it clearer it is for both branches

jamespetts

Sdog,

I haven't been involved in automated building of the pakset yet (although I plan to have a go at setting it up when/if I get the time), but the -Ex naming convention is specific to Experimental, the idea being to differentiate the .pak files compiled for Experimental from those compiled for Standard. It is not strictly necessary, but it is the naming convention for Pak128.Britain-Ex, and should be respected where possible to avoid, for example, duplicate items when upgrading.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

sdog

adding a Brit prefix and -Ex suffix is straightforward. But changing the first char of the directory (and later name strings) to upercase is not. It would be easy with sed, but not with gnu make functions. But using those outside programs will likely break the Makefile for windows.*

better news, i think i can almost cope with boats192 now.

could you please clarify how grounds should be treated? from the makeALL.mos it looked like all *.dat in grounds/ are paked into ground.Outside.pak not just ground.Outside.dat. This also looks like it in the pak128 release: 852K   ground.Outside.pak. Is this assumption correct?

*this is something i can't test by the way. i killed my win a couple of months ago by accident and wasn't able to reinstall it.



jamespetts

Sdog,

I can't answer all of your questions (The Hood is best placed to do that), but I can confirm that everything in the grounds subdirectory goes into ground.Outside.pak.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

sdog

So here's the first version of the Makefile for experimental. I'll do some further testing, and changing variables for standard to-morrow.

# Just run
#   make clean all archives
# to get fresh and ready to deploy .tbz2 and .zip archives
CONFIG ?= config.default
-include $(CONFIG)

MAKEOBJ ?= ./makeobj

PAKNAME ?= pak128.britain.testing
DESTDIR  ?= ./
PAKDIR   ?= $(DESTDIR)/$(PAKNAME)
DESTFILE ?= $(PAKNAME)

NAMEPREFIX ?=
NAMESUFFIX ?=

CPFILES ?= compat.tab

DIRS64 :=
DIRS64 += gui/gui64

DIRS128 :=
DIRS128 += attractions
DIRS128 += boats
DIRS128 += bus
DIRS128 += citybuildings
DIRS128 += citycars
DIRS128 += depots
DIRS128 += goods
DIRS128 += grounds
DIRS128 += industry
DIRS128 += london-underground
DIRS128 += maglev
DIRS128 += pedestrians
DIRS128 += smokes
DIRS128 += stations
DIRS128 += townhall
DIRS128 += trains
DIRS128 += trams
DIRS128 += trees
DIRS128 += ways
DIRS128 += gui/gui128

DIRS192 :=
DIRS192 += boats/192

DIRS224 :=
DIRS224 += boats/224


DIRS := $(DIRS64) $(DIRS128) $(DIRS192) $(DIRS224)

#generating filenames
#with this function the filenames are assembled, by removing the dir, adding prefix
#and suffix and excluding grounds
#all dat files in the grounds dir are paked into ground.Outside.pak
make_name = $(subst $(NAMEPREFIX)grounds$(NAMESUFFIX),ground.Outside.pak,$(NAMEPREFIX)$(notdir $1)$(NAMESUFFIX))


.PHONY: $(DIRS) copy tar zip clean

all: copy $(DIRS)

archives: tar zip

tar: $(DESTFILE).tbz2
zip: $(DESTFILE).zip

$(DESTFILE).tbz2: $(PAKDIR)
@echo "===> TAR $@"
@tar cjf $@ $(DESTDIR)

$(DESTFILE).zip: $(PAKDIR)
@echo "===> ZIP $@"
@zip -rq $@ $(DESTDIR)

copy:
@echo "===> COPY"
@mkdir $(PAKDIR)
@cp -prt $(PAKDIR) $(CPFILES)

$(DIRS64):
@echo "===> PAK64 $@"
@mkdir -p $(PAKDIR)
$(MAKEOBJ) quiet PAK $(PAKDIR)/$(call make_name,$@) $@/ > /dev/null

$(DIRS128):
@echo "===> PAK128 $@"
@mkdir -p $(PAKDIR)
$(MAKEOBJ) quiet PAK128 $(PAKDIR)/$(call make_name,$@) $@/ > /dev/null

#since the subdirectories in the boats dir lack a boats, the / is removed for the filename
#this will cause trouble as soon as files with a different structure are included.
#(e.g. planes/planes192)
$(DIRS192):
@echo "===> PAK192 $@"
@mkdir -p $(PAKDIR)
@$(MAKEOBJ) quiet PAK192 $(PAKDIR)/$(call make_name,$(subst /,,$@)) $@/ > /dev/null

$(DIRS224):
@echo "===> PAK224 $@"
@mkdir -p $(PAKDIR)
@$(MAKEOBJ) quiet PAK224 $(PAKDIR)/$(call make_name,$(subst /,,$@)) $@/ > /dev/null

clean:
@echo "===> CLEAN"
@rm -fr $(PAKDIR) $(DESTFILE).tbz2 $(DESTFILE).zip


config.template:



#makeobject executable (default ./makeobj)
MAKEOBJ = ./makeobj-ex

#name of the pakset the pakset destination dir is also named after it
PAKNAME = pak128.britain-ex

#Name of the tar and zip files. default is $(PAKNAME).
#DESTFILE =

#path where the pakset dir should be built (default ./)
#DESTDIR  =


#prefix and suffix for pak files (default empty)
NAMEPREFIX = brit-
NAMESUFFIX = -ex


#files and dirs to be copied into the pakset directory
#(default compat.tab only)
CPFILES = compat.tab readme.txt README
CPFILES += sound/ config/ text/ doc/


i'm breaking your filename convention a bit however. instead of BritAttractions-Ex.pak this Makefile makes brit-attractions-ex.pak. UCing the first char of the directory name is not achievable for me in Makefiles.

jamespetts

Sdog,

thank you very much - that is most kind. How does one use a makefile on a Windows system...?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

neroden

Quote from: sdog on May 30, 2010, 11:06:23 PM
could you please clarify how grounds should be treated? from the makeALL.mos it looked like all *.dat in grounds/ are paked into ground.Outside.pak not just ground.Outside.dat. This also looks like it in the pak128 release: 852K   ground.Outside.pak. Is this assumption correct?

The core code for Simutrans looks for ground.Outside.pak in order to identify whether it has found a .pak folder or not.  makeALL.mos actually packs each ground file into its own pak (so there are eleven ground.*.pak files).  This is actually stupid.  Ideally all the ground except for ground.Outside.pak would be in a BritGround.pak file.

jamespetts

Hmm, when I make it manually, I just put everything into ground.Outside.pak, which works fine.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

The filename is hardcoded as the best candidate for checking tile size. There is at the moment no better way to determine this, I'm afraid...?

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

prissi

It is not a good idea to pak everything into ground.outside.pak, as this file will be loaded twice and will be parsed also for every pak directory to determine, if it contains a pak or not.

You can have also a look at the Makefile for pak64, which is also in the SVN together with pak128.Britain.

sdog

the pak64 Makefile was very helpfull when i created the Makefile, which is based on the 64 file.

I can't think of an easy way to address the grounds issue in make, without using a script or doing filesystem operations. My suggestion is to take it out of the grounds dir and treat it independently.

update: Just did this, and pushed it to github.

Thanks for restructuring the boats/boats* directories! I can reduce the complexity of the makefile.:wq

update:
i also updated the Makefile and directory structure for standard in the same way. If you want to integrate the suggestion to experimental, please do it for standard too.
I haven't tested my changes to makeAll.mos (i always have trouble geting it to round properly)

sdog

James, you pulled and merged the changes into experimental. Did you do something for standard too? Or should i contact The Hood?

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.