Solved

Porting UNIX apps with makefiles

Posted on 1997-04-24
3
275 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

16 Experts available now in Live!

Get 1:1 Help Now