RE: Examples of Makefiles for Universal Binaries?
RE: Examples of Makefiles for Universal Binaries?
- Subject: RE: Examples of Makefiles for Universal Binaries?
- From: "Syd Polk" <email@hidden>
- Date: Mon, 5 Feb 2007 14:23:25 -0600
If you are not using Xcode's build system, I would have my makefile build
each architecture separately, and then lipo the resulting executables
together at the end.
> -----Original Message-----
> From: xcode-users-bounces+sydvicious=email@hidden
> [mailto:xcode-users-bounces+sydvicious=email@hidden
] On Behalf Of Rick Mann
> Sent: Monday, February 05, 2007 2:18 PM
> To: email@hidden
> Subject: Examples of Makefiles for Universal Binaries?
>
> 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:
> 40mac.com
>
> This email sent to email@hidden
>
_______________________________________________
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