Solved

Porting UNIX apps with makefiles

Posted on 1997-04-24
3
286 Views
Last Modified: 2013-12-26
Yes, you guessed it.  I'm trying to figure out how the heck
to port a UNIX app (actually a library) to the Mac, Code
Warrior style.  I'm a moderately-experienced UNIX programmer
but I don't know make terribly well (most of my coding was
done with pre-set-up makefiles or I made very simple, straightforward makefiles.).  I'm a very beginning Mac
programmer, but I've got good books, so I'm not having too
much trouble on that end of things.

I realize this is rather a large question for this venue.
Therefore, any kind of documentation (books, web pages,
heiroglyphics on the walls of ancient Egyptian temples) that
someone could point me towards would be wonderful.  If not,
perhaps a brief description of the process, along with such
specifics as would be necessary in order to keep me from
having to pull all of my hair out repeatedly as I am doing
right now.

In case you're wondering, the library is SSLeay, the free
secure-sockets library.  I'm trying to compile it using
GUSI, the Mac sockets implementation.  If by some bizarre
wild coincidence someone has already ported it, send it my
way! :)
0
Comment
Question by:thalen
  • 2
3 Comments
 

Accepted Solution

by:
heller earned 200 total points
ID: 1291440
Well, Code Warrior's IDE does not use Makefiles like is typically
used with UNIX.  Code Warrior uses a "Project File".  Actually it
is much like your "pre-set-up makefiles".  They have various files called "stationary", which are generic style project files.

You find a stationary file that is much like what your project is, such as a "MacOS 68K Library" or a "PowerPC Application", etc. And load this into the IDE and then modify it by adding in
your source files (C, C++, assembler, resources, etc.) and adjust
the path info and so on in the Preferences section.

I am in the process of porting a UNIX shareware app to the Mac and it is not too hard.  The main gotcha is you need separate project files for 68K and PowerPC and there is no easy way to make sure both project files contain all of the source files -- I got bit by that problem -- with Makefiles you can use one makefile for multiple targets, so this sort of problem can be avoided.
0
 

Author Comment

by:thalen
ID: 1291441
I know what a project file is.  So what you're saying is 'just
set up the Mac end with a project file and add all of the files
in the source code into the project file and make it and everything should work'?  That sounds suspiciously utopian.

(I say that, having tried exactly that approach and having come
up with ~3500 compiler errors.  I'm looking for some general
pointers on the porting.  You know, the 'okay it doesn't compile
let's see why not' kind of stuff.  )

0
 

Expert Comment

by:heller
ID: 1291442
Ok, your question was vauge, sorry.  If I knew what sort of compiler errors you are getting I might be able to offer more specific help.  *I* don't know of any magic documentation for Project files.  All I can say is make sure things are sane with your project file's preferences. Things like the path to the include files and make sure you are building the right sort of thing (application, library, etc.)

You should only add the true source files -- ones that get compiled -- .c & .cc, assembler source, and resource files (the resources only make sense for applications).  The header files don't get added, but your preferences need to have the path(s) to the includes setup properly (make sure you DON'T remove the path to the system include files).  There is also a preference for how to deal with "#include <foo.h>", where foo.h is one of your include files.  You need to look closely at your project's preferences, important parts are the language settings (Require Function Prototypes is normally on -- if the code is old style K&R C, you will likely get tons of errors), and look at the settings under the "Project" setting -- make sure your Project Type is what you expect (Library, Application, etc.),  your access paths are what you expect -- check the state of the "Treat #include <...> as #include "..." -- by default this is off.  Most UNIX C compilers merge all of the include search paths together (i.e. system ones (/usr/include/...) and user ones (-Ipath)) and will search for #include <...> under this combined set of paths. Code Warrior does not.  Instead, #include <...> are only searched for in the system paths and #include "..." are searched in the user paths.  If your code is typical UNIX C, it is probably expecting -I<path> flags being passed to the compiler and is doing #include <...>, without the Treat ... check box on, these include files are not being found, so what they define is no happening.  Also check in the target section to be sure Code Warrior knows how to properly process your files.  

Note: MacOS uses case insensitive file name matching.  UNIX is case sensitive.  Under UNIX, some people use a capital C for C++ as in foo.C.  On the Mac, this is no different from foo.c, a plain C file.  Code Warrior will pass this to the C compiler, not the C++ compiler.  All of your C++-isms will fail. Opps.  Rename the file to foo.cc and replace foo.C with foo.cc in the project file list.

If you use some odd extension for source files, you need to add this extension to the list of known extensions.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
Detect CR LF to each line 12 158
noX challenge 17 112
Excel file not created as expected 7 69
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now