• 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
Examples of Makefiles for Universal Binaries?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Examples of Makefiles for Universal Binaries?


  • Subject: Examples of Makefiles for Universal Binaries?
  • From: Rick Mann <email@hidden>
  • Date: Mon, 5 Feb 2007 12:17:52 -0800

Hi. I've got a relatively simple makefile that uses a pattern rule to build my individual sources. I'm building native binaries just fine, but I'd like to build a Universal Binary. I don't want to change it to a bunch of explicit rules, so I'm hoping someone can point me at an example of a Makefile that build universal binaries. Mine's included. It's using gdc, a D compiler built on top of gcc (Apple's gcc), and it's a bit unusual in that sources (and objects) are store hierarchically, akin to Java sources and classes. Hence all the $ (shell find) and $(patsubst) stuff.

I just want to figure out how to add the steps for universal binary. Apple's docs on gcc suggest you can just put in two -arch flags and it'll build universal binaries, but that's not working for me. My build involves a couple of static libraries, so perhaps I just need to add something to the $(AR) line?

Thanks!

----------------

SRCDIR = src/d
OBJDIR = target/obj
DOCDIR = target/doc
APISRC = $(shell find $(SRCDIR)/macos -name "*.d" -and ! -path "*externals*")
APIOBJ = $(patsubst $(SRCDIR)/%.d, $(OBJDIR)/%.d.o, $(APISRC))


DARBONSRC = $(shell find $(SRCDIR)/darbon -name "*.d" -and ! -path "*externals*")
DARBONOBJ = $(patsubst $(SRCDIR)%.d, $(OBJDIR)%.d.o, $(DARBONSRC))


CGSRC			= $(wildcard $(SRCDIR)/macos/coregraphics/*.d)
CGOBJ			= $(patsubst $(SRCDIR)%.d, $(OBJDIR)%.d.o, $(CGSRC))

TESTSRC			= src/test/d

AR				= ar
GDC             = gdc
GDMD            = gdmd

BUILD_CMD=  if [ -d "$$dir" ]; then \
		(	cd $$dir && echo "making $$target in $$dir..." && \
			$(MAKE) -e $(BUILDENV) TOP=../.. DIR=$$dir $$target \
		) || exit 1; \
		fi

# all should be changed once things have stabilized a bit.
# build framework, maybe not examples.

all: api framework examples Makefile
	

debug:
	@echo "API Sources:    ${APISRC}"
	@echo "API Objs:       ${APIOBJ}"
	@echo "DARBON Sources: ${DARBONSRC}"
	@echo "DARBON Objs:    ${DARBONOBJ}"

api: $(APIOBJ) Makefile
	@mkdir -p target/lib
	$(AR) -cru target/lib/libdarbonapi.a $(APIOBJ) $(CGOBJ)

framework: $(DARBONOBJ) Makefile
	@mkdir -p target/lib
	$(AR) -cru target/lib/libdarbon.a $(DARBONOBJ)

examples: SimpleSketch Demo

SimpleSketch:
	@dir=examples/SimpleSketch; target=all; $(BUILD_CMD)

Demo:
	@dir=examples/Demo; target=all; $(BUILD_CMD)

$(OBJDIR)/%.d.o : $(SRCDIR)/%.d Makefile
	@mkdir -p $(dir $@)
	@mkdir -p $(DOCDIR)
	$(GDC) -g -c -fdoc-dir=$(DOCDIR) -I $(SRCDIR) -o $@ $(SRCDIR)/$*.d




_______________________________________________ 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: Examples of Makefiles for Universal Binaries?
      • From: "Syd Polk" <email@hidden>
  • Prev by Date: Re: Token Concatation in Info.plist Files?
  • Next by Date: RE: Examples of Makefiles for Universal Binaries?
  • Previous by thread: DWARF debug info sharing across objects
  • Next by thread: RE: Examples of Makefiles for Universal Binaries?
  • Index(es):
    • Date
    • Thread