Welcome, Guest. Please login or register.

Author Topic: Visual Studio, GNU Makefiles and Cross Compiling.  (Read 4326 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Visual Studio, GNU Makefiles and Cross Compiling.
« on: November 20, 2011, 06:42:44 PM »
I've been tinkering with a little "project" to create Visual Studio wizards that aid in the creation of Amiga projects using VS. The wizard basically creates a Makefile project that points to a GCC cross compiler installed on the machine. This whole idea is based on this news item posted by Arthur Moyer on the "late" UtilityBase some time ago.

Bare in mind, I'm no C++ expert, and even less familiar with makefiles, which is exactly why I'm posing these questions here, to get a clue as to what certain things mean.

For example, here's the basic makefile that I started with:
Code: [Select]
# Project: Hello
# Compiler: m68k-Amiga-OS3
# Compiler Type: MingW 3
# GNU Makefile template for Visual Studio

CPP       = m68k-amigaos-g++.exe
CC        = m68k-amigaos-gcc.exe
WINDRES   = windres.exe
OBJ       = Hello.o
LINKOBJ   = Hello.o
LIBS      = -L"P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\lib"
            -L"P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\lib\libb\libnix"  
INCS      = -I"P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include"
CXXINCS   = -I"P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include"
RCINCS    = --include-dir "P:\Windows\AmiDevCpp\include\c++\3.4.2\backward"
BIN       = Hello
DEFINES   = AMIGA
CXXFLAGS  = $(CXXINCS) $(DEFINES) -s -noixemul
CFLAGS    = $(INCS) $(DEFINES) -s -noixemul
GPROF     = gprof.exe
RM        = rm -f
LINK      = m68k-amigaos-g++.exe

.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after

clean: clean-custom
$(RM) $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(LINK) $(LINKOBJ) -o "Hello" $(LIBS)

Hello.o: $(GLOBALDEPS) main.cpp
$(CPP) -c main.cpp -o Hello.o $(CXXFLAGS)

So, here are a couple of questions I have about this GNU makefile which was generated by AmiDevCpp.

What does RCINCS mean, and why is it separate from INCS and CXXINCS? The makefile built by AmiDevCpp pointed it to "P:/Windows/AMIDEV~1/" but if I point it to "P:\Windows\AmiDevCpp\include\c++\3.4.2\backward" (my installation, obviously :) ) and include it as a reference in the Visual Studio project, Intellisense works as it should.

I'm a little concerned about that reference, especially the meaning of the directory "backward". If anyone has any thoughts on that, feedback would be appreciated.

I think I understand about the -noixemul flag, it means "no unix emulation" but what does it really do? Thoughts appreciated.

Finally, what does that -s flag represent?

Any and all feedback is appreciated.
« Last Edit: November 20, 2011, 07:17:43 PM by EDanaII »
Ed.
 

Offline x303

Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #1 on: November 20, 2011, 07:36:53 PM »
Quote from: EDanaII;668507

I think I understand about the -noixemul flag, it means "no unix emulation" but what does it really do? Thoughts appreciated.
-noixemul means "don't link with the ixemul.library code". Ixemul makes porting programs from other systems a bit easier, but should not be used when compiling amiga native code.
 

Offline Heiroglyph

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 1100
    • Show only replies by Heiroglyph
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #2 on: November 21, 2011, 01:18:59 AM »
I think RCINCS is for windows resources, so I doubt it's required here unless Visual Studio complains about not having it.

Interesting idea, I wish I had more to give back, but I hate makefiles with a passion.

I will be very interested in see what comes of it though.  If there is one thing MS is good at, it's IDEs.
 

Offline Heiroglyph

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 1100
    • Show only replies by Heiroglyph
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #3 on: November 21, 2011, 01:25:37 AM »
Oops, forgot:
-s  Remove all symbol table and relocation information from the executable.

Here is a reference:
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #4 on: November 21, 2011, 11:53:33 PM »
Thanks for the reference. I had looked around a little bit, but wasn't sure where to find it.

I did a quick test on RCINCS and it looks like it isn't needed after all. I initially thought it was because, after adding the C++ "backwards" path, Intellisense was working properly, but it appears it doesn't matter which include I use for that, so you may be right on that one.

If I can make something useful, I'll release it for whoever wants it. Right now, I'm simply trying to "clone" what AmiDevCpp does. Eventually, if I can get there, I'll try and get it working with CMAKE, and then we needn't worry about Makefiles (directly) at all. :) Yea, I hate makefiles too. ;)


@ All

OK, a couple more quick questions for any who know...

OK, so -noixemul prevents linking to the ixemul library... so I assume this is only useful to projects that are porting Posix software? Or is it broader than that? Also, that Libnix reference in LIBS... is that a reference to ixemul? Or an alternate? What's it's purpose?
Ed.
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 643
    • Show only replies by nyteschayde
    • http://www.nyteshade.com
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #5 on: November 22, 2011, 03:39:14 AM »
Quote from: EDanaII;668633

If I can make something useful, I'll release it for whoever wants it. Right now, I'm simply trying to "clone" what AmiDevCpp does. Eventually, if I can get there, I'll try and get it working with CMAKE, and then we needn't worry about Makefiles (directly) at all. :) Yea, I hate makefiles too. ;)


I'd be happy to know where you end up on this. I'd love to use a better IDE. If you keep the stuff abstracted enough we might be able to make XCode (on the Mac) do work as well. I'm still trying to track down some decent g++ cross compiler solutions for the Mac.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline Heiroglyph

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 1100
    • Show only replies by Heiroglyph
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #6 on: November 22, 2011, 06:02:05 AM »
Quote from: EDanaII;668633

OK, so -noixemul prevents linking to the ixemul library... so I assume this is only useful to projects that are porting Posix software? Or is it broader than that? Also, that Libnix reference in LIBS... is that a reference to ixemul? Or an alternate? What's it's purpose?


Here is a pretty good source for what you're doing.  This page is particularly relevant:  http://www.tbs-software.com/guide/index.php?guide=gg.doc%2Fgcc-amigaos.guide&node=-noixemul
 

Offline bm07

  • Newbie
  • *
  • Join Date: Jul 2009
  • Posts: 33
    • Show only replies by bm07
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #7 on: November 22, 2011, 04:13:48 PM »
Quote from: EDanaII;668633
OK, so -noixemul prevents linking to the ixemul library... so I assume this is only useful to projects that are porting Posix software? Or is it broader than that? Also, that Libnix reference in LIBS... is that a reference to ixemul? Or an alternate? What's it's purpose?

I believe libnix is an alternative to ixemul. Ixemul.library is loaded at runtime from LIBS. libnix.a is statically linked at compile time. They both provide C runtime library functions like malloc, fopen, strcpy, etc.
 
Libnix:
http://sourceforge.net/projects/libnix/
 
Ixemul.library:
http://amiga.svn.sourceforge.net/viewvc/amiga/ixemul/
 

Offline Heiroglyph

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 1100
    • Show only replies by Heiroglyph
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #8 on: November 22, 2011, 05:18:14 PM »
Libnix is more Amiga like, ixemul is very posix oriented.

Unless you're porting, you'd want to use libnix via -noixemul.
 

Offline SACC-guy

Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #9 on: November 22, 2011, 08:39:23 PM »
@heiroglyph
Have you looked at codebench or AVD? If so, what are your thoughts?
 

Offline NovaCoder

Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #10 on: November 23, 2011, 02:23:04 AM »
Something I tried to setup (and failed!) was to use C++ Eclipse IDE on Windows using mingw.

If someone could get that working it would be a great way to write 68k for classics using gcc.
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #11 on: November 23, 2011, 03:44:13 AM »
Actually, Novacoder, I've got Eclipse working too and it wasn't too dificult to set up. What version did you attempt it on? Maybe things have changed a little since then. Of course, the examples I've managed to compile are fairly simple, so... It was much more difficult than telling Eclipse to "New makefile from code", point it to the correct makefile and make sure the compiler found the correct libraries.


@ nyteschayde:
Quote
I'd be happy to know where you end up on this. I'd love to use a better IDE. If you keep the stuff abstracted enough we might be able to make XCode (on the Mac) do work as well. I'm still trying to track down some decent g++ cross compiler solutions for the Mac.


What I'm doing is fairly simplistic. It really doesn't consist much more than setting up the wizard to update VS, fill out a makefile "template" and provide starter code. I might have something for people to play with in a month. That's assuming I don't distracted by something else, of course...
Ed.
 

Offline NovaCoder

Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #12 on: November 23, 2011, 05:25:05 AM »
Quote from: EDanaII;668756
Actually, Novacoder, I've got Eclipse working too and it wasn't too dificult to set up. What version did you attempt it on? Maybe things have changed a little since then. Of course, the examples I've managed to compile are fairly simple, so... It was much more difficult than telling Eclipse to "New makefile from code", point it to the correct makefile and make sure the compiler found the correct libraries.


Cool,

I couldn't even get that far, maybe you could post up a tutorial when you get the time....
Life begins at 100 MIPS!


Nice Ports on AmiNet!