Skip to content

Instantly share code, notes, and snippets.

@technolize
Created March 29, 2009 05:18
Show Gist options
  • Save technolize/87289 to your computer and use it in GitHub Desktop.
Save technolize/87289 to your computer and use it in GitHub Desktop.
ARCH = armv6
SDKVER = 2.2
SDK = /Developer/Platforms/iPhoneOS.platform/Developer
SYSROOT = $(SDK)/SDKs/iPhoneOS$(SDKVER).sdk
CC = $(SDK)/usr/bin/arm-apple-darwin9-gcc-4.0.1
CPP = $(SDK)/usr/bin/arm-apple-darwin9-g++-4.01
LD = $(CC)
LDFLAGS += -framework CoreFoundation
LDFLAGS += -framework Foundation
LDFLAGS += -L"$(SDK)/usr/lib"
LDFLAGS += -F"$(SDK)/System/Library/Frameworks"
LDFLAGS += -F"$(SDK)/System/Library/PrivateFrameworks"
LDFLAGS += -lobjc
LDFLAGS += -dynamiclib
LDFLAGS += -march=$(ARCH)
LDFLAGS += -mcpu=arm1176jzf-s
LDFLAGS += -fobjc-call-cxx-cdtors
LDFLAGS += -isysroot $(SYSROOT)
CFLAGS += -I"$(SDK)/usr/lib/gcc/arm-apple-darwin9/4.0.1/include"
CFLAGS += -I"$(SYSROOT)/usr/include"
CFLAGS += -I"$(SDK)/usr/include"
CFLAGS += -F"$(SYSROOT)/System/Library/Frameworks"
CFLAGS += -F"$(SYSROOT)/System/Library/PrivateFrameworks"
CFLAGS += -DDEBUG -std=c99
CFLAGS += -Diphoneos_version_min=2.2
CFLAGS += -arch $(ARCH)
CFLAGS += -dynamiclib
CPPFLAGS = $(CFLAGS)
TARGET = Toggle.dylib
all: $(TARGET)
$(TARGET): main.o
$(LD) $(LDFLAGS) -o $@ $^
ldid -S $(TARGET)
%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f *.o $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment