Skip to main content
Topic: [fix] Compile makeobj for the same OSTYPE as simutrans (Read 3209 times) previous topic - next topic

[fix] Compile makeobj for the same OSTYPE as simutrans

This is a Makefile patch which eliminates some annoying behavior which causes my tree to continually differ from upstream.

Previously makeobj/Makefile had to be edited directly to set the ostype.

Now it uses config.default from the parent directory.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #1
While you are at it: Now makeobj and simutrans requires log.cc to be compiled differently. debug_t::fatal(..) compiles differently with/without graphics. Maybe you know a Makefile trick to generate two different log.o's ? One for simutrans, one for makeobj.
Parsley, sage, rosemary, and maggikraut.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #2
Actually, for BeOS, I have to use the Linux switch ... The makeobj makefile was never updated to the system simutrans uses. This would make most sense imho.

For the problem in question I would jsut suggest to delete log.o after linking makeobj always.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #3
While you are at it: Now makeobj and simutrans requires log.cc to be compiled differently. debug_t::fatal(..) compiles differently with/without graphics. Maybe you know a Makefile trick to generate two different log.o's ? One for simutrans, one for makeobj.

Well, I actually do.  It's totally straightforward if you think about it -- just build a different object file from the .c file, and link that one instead of log.o:
Code: [Select]
makeobj-log.o: log.cc
   $(CXX) $(CXXFLAGS) -DMAKEOBJ -o $@ -c $<
(I probably didn't get the directories or other details right there, of course.)

EDIT: it gets messy in the presence of automatic dependency generation, however.

Note that simtools.o is different in MAKEOBJ too.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #4
Actually, for BeOS, I have to use the Linux switch ...
Interesting, why?  The only difference (in makeobj) is that -lm is linked with the Linux switch.  This could be added to the BeOS configuration, no problem.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #5
You are right about BeOS. Aparently I changed this once and just kept it that way.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #6
Aaaand, here's the revised, dramatic patch which reconstructs the entire makeobj build to use a very similar system to the simutrans build.

I had to make an altered version of common.mk, hence "uncommon.mk".

Works on Linux.  If it's broken anywhere else it should work with minor CXXFLAGS or STD_LIBS changes.

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #7
Well, order of libraries under mingw must be exactly in this order in the makefile but otherwise worked fine.

By the way, now makeobj is 20 kB larger, might be the new compiler settings ...

Re: [fix] Compile makeobj for the same OSTYPE as simutrans

Reply #8
Well, order of libraries under mingw must be exactly in this order in the makefile but otherwise worked fine.

By the way, now makeobj is 20 kB larger, might be the new compiler settings ...

Oh, probably that's the change in optimization settings.  If we care about size we should use -Os instead of -O2.

Commit appears to have lost a file

Reply #9
The commit to SVN seems to have lost the file makeobj/uncommon.mk

The patch will not work without it; please commit.

Extra copy attached (zipped).