Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • 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 EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #1 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 EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: Visual Studio, GNU Makefiles and Cross Compiling.
« Reply #2 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.