• 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
Re: Pass a C option based on command-line output?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pass a C option based on command-line output?


  • Subject: Re: Pass a C option based on command-line output?
  • From: Daniel Jalkut <email@hidden>
  • Date: Sun, 8 Jan 2006 10:39:23 -0500

Thanks, Brian. But unless I'm missing something, these all rely on my using a Makefile. Since I'm moving away from the Makefile, I'd like to come up with a solution that doesn't depend on make (otherwise I'd just use the entire Makefile, and everything "works fine."

What I'm leaning towards is a "generated source file" that includes a #define for the desired value. It's quite a different approach from the original Makefile, but ...

Daniel

On Jan 8, 2006, at 9:47 AM, Brian Onn wrote:

I have 4 possible solutions, not in any particular order:

1) You could set the HOSTNAME inside the Makefile where it's
needed, using make features to execute a shell script:

	HOSTNAME	:=	$(shell /bin/hostname)
	$(CC) -DHOSTNAME=$(HOSTNAME) ...

2) you could create a shell script to run the make and have xcode execute
this shell script as the build command in your target settings, instead
of /usr/bin/make


	#!/bin/sh
	export HOSTNAME=`hostname`
	exec /usr/bin/make -DHOSTNAME=${HOSTNAME} "$@"

3) use the shell as your target settings Build Command, like this:
Build Tool: /bin/sh
Arguments: -c 'exec /usr/bin/make HOSTNAME=`hostname` $$@' xx $ (ACTION)


4) use perl as your target settings Build Command, like this:
Build Tool: /usr/bin/perl
Arguments: -MSys::Hostname -e '$$ENV{"HOSTNAME"}=hostname(); exec "/usr/bin/make",@ARGV;' $(ACTION)




_______________________________________________ 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
References: 
 >Pass a C option based on command-line output? (From: Daniel Jalkut <email@hidden>)
 >Re: Pass a C option based on command-line output? (From: Chris Espinosa <email@hidden>)
 >Re: Pass a C option based on command-line output? (From: Daniel Jalkut <email@hidden>)
 >Re: Pass a C option based on command-line output? (From: Brian Onn <email@hidden>)

  • Prev by Date: Re: Pass a C option based on command-line output?
  • Next by Date: Re: Avoiding destructors while still calling atexit handlers
  • Previous by thread: Re: Pass a C option based on command-line output?
  • Next by thread: Re: Pass a C option based on command-line output?
  • Index(es):
    • Date
    • Thread