[Patch] New Makefile

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: [Patch] New Makefile

Postby Ian » Sun Jan 21, 2018 8:13 am

Well I had a go at cleaning up the header files. Hopefully included your changes as well

Code: Select all
using namespace Debugger;
// TODO - can't get this namespace to work with 68K.h for some reason - strange Visual Studio errors
//namespace Debugger
//{


in Musashi68KDebug.h
still needs to be looked at
Ian
 
Posts: 1481
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Sun Jan 21, 2018 8:44 am

Ian, I made some progress: there was a name conflict between "\Src\Debugger\IO.h" and a same named file in mingw32 system headers. I think during compilation, probably, the former took precedence over the latter in some way and, as a side effect, "_chsize" remained undefined, where usually is defined at system level. Plus many other things consequentially broke.

I resolved all by:
- renaming "IO.cpp" to "DebuggerIO.cpp"
- renaming "IO.h" to "DebuggerIO.h"
- change accordingly every reference to that file.

It remains only a "bug": if I compile with both ENABLE_DEBUGGER and NET_BOARD set then at link time it throws out this:
Code: Select all
_obj/CPUDebug.o:CPUDebug.cpp:(.text+0x8df): undefined reference to `CThread::CreateMutex()'
_obj/Debugger.o:Debugger.cpp:(.text+0x1408): undefined reference to `CThread::CreateMutex()'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefiles/Makefile.inc:288: _bin/supermodel] Error 1
make: Target 'all' not remade because of errors.

Now it behaves in all aspects like the old makefile, bug included. Probably the changed compile/link order from the older one made a difference.

I'll post the final patch in few minutes, however someone should rename those two files in the repository.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby Ian » Sun Jan 21, 2018 8:51 am

It shouldn't be possible for headers to conflict like that ..
Check maybe for a redefining of this

INCLUDED_IO_H

CThread::CreateMutex()
Could be failing if windows.h is included first because it has a macro for CreateMutex i think

simply
#ifdef _WIN32
#undef CreateMutex
#endif

might work
Ian
 
Posts: 1481
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Sun Jan 21, 2018 9:10 am

Ian wrote:It shouldn't be possible for headers to conflict like that ..
Check maybe for a redefining of this

INCLUDED_IO_H

Actually, I've done that too.
EDIT: it seems that name also matters, otherwise it won't compile. I'm posting the patch.

Ian wrote:simply
#ifdef _WIN32
#undef CreateMutex
#endif

might work

I'll try that
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby HarryTuttle » Sun Jan 21, 2018 9:48 am

PATCH for r705:

- Updated makefiles to support the various compile options: internal debugger, debug mode, new frame sync, net board. For example launch with "make -f Makefile.Win32 ENABLE_DEBUGGER=1"

- Tested only under MSYS2 and Windows 7 x64. On this OS it should automatically check for 64 or 32 bit OS type. Also it should use the appropriate delete console command when cleaning ("rmdir" for Windows prompt, "rm" for Bash)

- Renamed every reference to "IO[.h|.cpp]" into "DebuggerIO[.h|.cpp]" and made other changes to IO.h as it caused some problem during compilation when ENABLE_DEBUGGER was set

- Updated "UDPSend.cpp" to support inet_pton() function under MinGW/GCC

If using MinGW, before applying the patch, it's important to manually rename "\Src\Debugger\IO[.h|.cpp]" into "\Src\Debugger\DebuggerIO[.h|.cpp]", at least until the names stay as they are in the official repository.

There's still a compile issue with both ENABLE_DEBUGGER and NET_BOARD set, I'm investigating. EDIT: Fixed with addendum #2
Attachments
diff_03.zip
(22.74 KiB) Downloaded 84 times
Last edited by HarryTuttle on Sun Jan 21, 2018 11:25 am, edited 1 time in total.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby HarryTuttle » Sun Jan 21, 2018 10:44 am

PATCH Addendum #1 (Ian that's for you):

- Some more "using namespace std" removal
Attachments
diff_03u1.zip
(3.33 KiB) Downloaded 79 times
Last edited by HarryTuttle on Sun Jan 21, 2018 11:25 am, edited 2 times in total.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby HarryTuttle » Sun Jan 21, 2018 11:21 am

PATCH Addendum #2:

- Fix link error when compiling with both ENABLE_DEBUGGER and NET_BOARD set
Attachments
diff_03u2.zip
(940 Bytes) Downloaded 79 times
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 5:19 am

I'll try push these tonight
I don't use makefiles so may need Bart to have a look at those

Using namespaces is totally fine. But doing it in header files can cause some painful unwanted side effects.
Ian
 
Posts: 1481
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby Ian » Mon Jan 22, 2018 11:26 am

Harry,
does your compiler support
https://msdn.microsoft.com/en-us/librar ... 63(v=vs.85).aspx
inet_addr
?
Ian
 
Posts: 1481
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] New Makefile

Postby HarryTuttle » Mon Jan 22, 2018 11:39 am



From what I've just read it should as long as I link with libwsock32 and libws2_32.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 3 guests