• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Make XCode automatically link files produced by shell script phase
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make XCode automatically link files produced by shell script phase


  • Subject: Make XCode automatically link files produced by shell script phase
  • From: Jonas Maebe <email@hidden>
  • Date: Fri, 17 Jun 2005 23:54:46 +0200

Hello,

I've been doing a bit more experimenting since my previous question regarding getting access to specified frameworks during custom script phase, and came up with a possible alternative approach, but can't get it to work either.

So, what I have:

* create a custom build rule for Pascal files, with the following shell script:

for variant in $BUILD_VARIANTS
do
for arch in $ARCHS
do
mkdir -p "$OBJECT_FILE_DIR"-"$variant"/"$arch"
/usr/local/bin/ppc$arch "$INPUT_FILE_PATH" -Sg -Ci -Co -Cn -g - gl -O1 -vr -ap -Mmacpas -Tdarwin -Fi/Developer/Pascal/UPInterfaces - Fu/Developer/Pascal/UPInterfaces - FE"$OBJECT_FILE_DIR"-"$variant"/"$arch"
done
done


The -Cn option means "do not call the linker". The -FE option specifies where the output files (object files) should be put. I put them in exactly the same place as where gcc puts them using the default rules.

The problems with this are

a) There is no way to set output files, because they are put in different directories depending on the "BUILD_VARIANT" and the "ARCHS" (or can I put $(ARCHS) and $(BUILD_VARIANT) in the output file path and will XCode expand it internally to as many separate output file statements as necessary?)
b) Even if I hardcode the output file to $(OBJECT_FILE_DIR)-normal/ ppc/$(INPUT_FILE_BASE).o (since since I'm only generating PPC code currently), XCode does not do anything with the output files I generate
c) When using internal build rules, XCode generates a file called $LINK_FILE_LIST_<BUILD_VARIANT>_<ARCH> in which it stores all files which should be linked. Using a hack (see below if you are interested) I can get the value of this variable in a generic way in the script, but no matter what I put in that file, XCode refuses to perform a linking step


So my question is: what do I have to do to get XCode to perform a linking step in this situation (without requiring users to manually add all the .o files to the linking phase), and how can I tell it which objects to use? In the help I found some information about preprocessing custom files into C code and feeding them back to XCode, but putting my .o files in the mentioned DERIVED_FILES_DIR does not do anything either.


Jonas

PS: the reason I do not let the compiler perform the linking, is because during the script phase I cannot know which libraries and frameworks have been added to the project by the developer

PS2: Hack to get the content of the appropriate LINK_FILE_LIST variable in the above loop:

mkdir -p "$PROJECT_TEMP_DIR"
echo echo \$LINK_FILE_LIST_"${variant}"_"${arch}" > "$PROJECT_TEMP_DIR"/getlinkfilelistname.sh
`$CHMOD +x "$PROJECT_TEMP_DIR"/getlinkfilelistname.sh`
LINK_FILE_LIST=`"$PROJECT_TEMP_DIR"/getlinkfilelistname.sh`


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Make XCode automatically link files produced by shell script phase
      • From: Michael Casteel <email@hidden>
  • Prev by Date: Re: Setting Environment Variable in Xcode 2.1
  • Next by Date: Re: embedding private frameworks in Xcode 2.1
  • Previous by thread: MallocDebug, Out of memory error
  • Next by thread: Re: Make XCode automatically link files produced by shell script phase
  • Index(es):
    • Date
    • Thread