WZ2100 Makefile

Discuss the future of Warzone 2100 with us.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

WZ2100 Makefile

Post by cajadas »

Hi,

I have written two files (.h and .cpp) but i can't figure it out how to import them to the wz2100 source.

The only way i was able to compile my files in the project was by directly changing the source folder Makefile, but i guess that if i run configure my modified Makefile will be reset. What files do i have to change and where?

Also, when i try to compile my files after including the file droid.h, i keep getting this error on build:

Code: Select all

In file included from functiondef.h:27:0,
                 from objectdef.h:30,
                 from droid.h:30,
                 from vfc.cpp:11:
statsdef.h: In member function ‘uint32_t LineView::i8(unsigned int)’:
statsdef.h:126:49: error: ‘INT8_MIN’ was not declared in this scope
statsdef.h:126:60: error: ‘INT8_MAX’ was not declared in this scope
statsdef.h: In member function ‘uint32_t LineView::u8(unsigned int)’:
statsdef.h:127:60: error: ‘UINT8_MAX’ was not declared in this scope
statsdef.h: In member function ‘uint32_t LineView::i16(unsigned int)’:
statsdef.h:128:49: error: ‘INT16_MIN’ was not declared in this scope
statsdef.h:128:60: error: ‘INT16_MAX’ was not declared in this scope
statsdef.h: In member function ‘uint32_t LineView::u16(unsigned int)’:
statsdef.h:129:60: error: ‘UINT16_MAX’ was not declared in this scope
statsdef.h: In member function ‘uint32_t LineView::i32(unsigned int)’:
statsdef.h:130:49: error: ‘INT32_MIN’ was not declared in this scope
statsdef.h:130:60: error: ‘INT32_MAX’ was not declared in this scope
statsdef.h: In member function ‘uint32_t LineView::u32(unsigned int)’:
statsdef.h:131:60: error: ‘UINT32_MAX’ was not declared in this scope
What is this about?

Thank you.
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: WZ2100 Makefile

Post by Cyp »

Try changing Makefile.am (which gets turned into Makefile when building).

Try #include "lib/framework/frame.h" before #include "droid.h".
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

Makefile.am doesn't make any reference to source files, just folders, and i've copied my files to the src folder.

I had already included "lib/framework/frame.h" when i tried to build.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: WZ2100 Makefile

Post by cybersphinx »

Use a Makefile.am in one of the source directories, that'll set proper include paths as well.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

I've included mu .h and .cpp files on the "noinst_HEADERS" and "warzone2100_SOURCES" lists but when i ran configure the files don't appear on the resulting Makefile.

Is there something missing?
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: WZ2100 Makefile

Post by cybersphinx »

Just run make, that should regenerate the Makefile.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

I don't think so. When i modified the Makefile inside the src folder so it would compile my files i ran make and it wouldn't regenerate the Makefile. I guess it only regenerates when i run configure.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: WZ2100 Makefile

Post by cybersphinx »

Have you tried it? When Makefile.am changes, it should regenerate the respective Makefile.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

Yes. I've tried it. I included my .h and .cpp files in the "noinst_HEADERS" and "warzone2100_SOURCES" lists in the Makefile.am, run make, and everything is the same. I've also looked into the Makefile and my files don't appear there.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: WZ2100 Makefile

Post by cybersphinx »

Hm. Then redo the whole autogen.sh, configure, make process. autogen.sh makes the Makefile.ins, configure then turns those into Makefiles.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

Awesome, all working. Guess what was missing was the autogen.sh.

However, i still get the error i've mentioned in the first post when i include droid.h. The includes i have in the cpp are:

Code: Select all

#include "lib/framework/wzapp_c.h"
#include "lib/framework/frame.h"

#include "droid.h"
#include "vfc.h"          //<- my file
Any clue?

Thanks cybersphinx
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: WZ2100 Makefile

Post by cybersphinx »

Making an empty file with

Code: Select all

#include "lib/framework/frame.h"
#include "lib/framework/wzapp_c.h"

#include "droid.h"
(note the first two lines being switched) compiles without errors here.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: WZ2100 Makefile

Post by cajadas »

Looks like that was all it took.

Thanks.