Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new list user: I have a problem with a makefile



On Aug 14, 2005, at 4:27 PM, Paul Archibald wrote:

If this belongs on another forum, let me know.

The unix-porting list might be better, but this one works.

I would like to migrate the makefile into an Xcode project for maintainablity, so if someone knows how to do that, swell. Our next version will do away with the Codewarrior entirely.

For what you're doing here, building this in Xcode should be pretty straightforward. (Building the load map -- the -M option -- is possibly an exception; do you really need that?) I'd suggest starting with a new "Java JNI Application" project and changing that one to match your needs.


$(TARGET): $(OBJECTS)
libtool -dynamic -M -single_module -o $@ $^ -lstdc++ -lc -lgcc > map
strip -x $@

When I try make (in the Terminal), I get (something like) this:
$ make
libtool -dynamic -M -single_module -o ../libJEngine.jnilib engine/mathx.o engine/auto.o -lstdc++ -lc -lgcc > map
libtool: can't locate file for: -lstdc++
libtool: file: -lstdc++ is not an object file (not allowed in a library)
libtool: can't locate file for: -lgcc
libtool: file: -lgcc is not an object file (not allowed in a library)
make: *** [../libJEngine.jnilib] Error 1
$

Try changing the libtool line to this:

g++ -Wl,-M -single_module -o $@ $^ > map

When you're building C++ code with any recent version of gcc, libstdc++ and libgcc are included automatically for you, and when you build with gcc on Mac OS X, libc (more properly libSystem) is included automatically for you, so you don't need to specify them.

Hope this helps,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >new list user: I have a problem with a makefile (From: Paul Archibald <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.