Permalink
Browse files

include a stripped theos.

  • Loading branch information...
1 parent d0babf9 commit c8d95f8ff19a8b64acd52a9e72e2e24195504ecf @DHowett committed Oct 28, 2010
Showing with 954 additions and 2 deletions.
  1. +2 −2 Makefile
  2. 0 theos/Prefix.pch
  3. +46 −0 theos/bin/fakeroot.sh
  4. +6 −0 theos/bin/install.copyFile
  5. +6 −0 theos/bin/install.exec
  6. +4 −0 theos/bin/install.mergeDir
  7. +55 −0 theos/bin/package_version.sh
  8. 0 theos/include/.keep
  9. 0 theos/lib/.keep
  10. +123 −0 theos/makefiles/common.mk
  11. +31 −0 theos/makefiles/instance/library.mk
  12. +84 −0 theos/makefiles/instance/rules.mk
  13. +31 −0 theos/makefiles/instance/tool.mk
  14. +7 −0 theos/makefiles/library.mk
  15. +17 −0 theos/makefiles/master/library.mk
  16. +99 −0 theos/makefiles/master/rules.mk
  17. +17 −0 theos/makefiles/master/tool.mk
  18. +30 −0 theos/makefiles/messages.mk
  19. +77 −0 theos/makefiles/package.mk
  20. +7 −0 theos/makefiles/platform/Darwin-arm.mk
  21. +7 −0 theos/makefiles/platform/Darwin.mk
  22. +7 −0 theos/makefiles/platform/Linux.mk
  23. +87 −0 theos/makefiles/rules.mk
  24. +25 −0 theos/makefiles/targets/Darwin-arm/iphone.mk
  25. +1 −0 theos/makefiles/targets/Darwin-arm/native.mk
  26. +29 −0 theos/makefiles/targets/Darwin/iphone.mk
  27. +22 −0 theos/makefiles/targets/Darwin/macosx.mk
  28. +1 −0 theos/makefiles/targets/Darwin/native.mk
  29. +37 −0 theos/makefiles/targets/Darwin/simulator.mk
  30. +25 −0 theos/makefiles/targets/Linux/iphone.mk
  31. +20 −0 theos/makefiles/targets/Linux/linux.mk
  32. +1 −0 theos/makefiles/targets/Linux/native.mk
  33. +6 −0 theos/makefiles/targets/_common/darwin.mk
  34. +9 −0 theos/makefiles/targets/_common/install_deb_local.mk
  35. +22 −0 theos/makefiles/targets/_common/install_deb_remote.mk
  36. +6 −0 theos/makefiles/targets/_common/linux.mk
  37. +7 −0 theos/makefiles/tool.mk
View
4 Makefile
@@ -1,7 +1,7 @@
TARGET = native
#DEBUG = 1
GO_EASY_ON_ME = 1
-include /Users/dustin/theos/makefiles/common.mk
+include theos/makefiles/common.mk
LIBRARY_NAME = libfauxsu
libfauxsu_FILES = fauxsu.cc
@@ -13,7 +13,7 @@ test_FILES = test.c
ADDITIONAL_CFLAGS = -Wno-format -Wno-sign-compare
include $(FW_MAKEDIR)/library.mk
-include $(FW_MAKEDIR)/tool.mk
+#include $(FW_MAKEDIR)/tool.mk
after-all:: $(FW_OBJ_DIR)/fauxsu.sh
View
0 theos/Prefix.pch
No changes.
View
46 theos/bin/fakeroot.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+required=0
+persistence=/tmp/dhbxxx
+
+while getopts ":p:rc" flag; do
+ case "$flag" in
+ :) echo "$0: Option -$OPTARG requires an argument." 1>&2
+ exit 1
+ ;;
+ \?) echo "$0: Option -$OPTARG unrecognized." 1>&2
+ exit 1
+ ;;
+ p) persistence="$OPTARG" ;;
+ r) required=1 ;;
+ c) delpersistence=1 ;;
+ esac
+done
+shift $((OPTIND-1))
+cmd=$*
+
+mkdir -p $(dirname $persistence)
+touch $persistence
+
+if [[ $delpersistence -eq 1 ]]; then
+ rm -f $persistence
+ exit 0
+fi
+
+if [[ "$USER" == "root" ]]; then
+ fakeroot=""
+elif type fauxsu &> /dev/null; then
+ fakeroot="fauxsu -p $persistence -- "
+elif type fakeroot-ng &> /dev/null; then
+ fakeroot="fakeroot-ng -p $persistence -- "
+elif type fakeroot &> /dev/null; then
+ fakeroot="fakeroot -i $persistence -s $persistence -- "
+else
+ if [[ $required -eq 1 ]]; then
+ fakeroot=""
+ else
+ fakeroot=": "
+ fi
+fi
+
+#echo $fakeroot $cmd
+$fakeroot $cmd
View
6 theos/bin/install.copyFile
@@ -0,0 +1,6 @@
+#!/bin/bash
+if [[ TARGET_REMOTE -eq 1 ]]; then
+ scp -P $FW_DEVICE_PORT $1 root@$FW_DEVICE_IP:$2
+else
+ cp $1 $2
+fi
View
6 theos/bin/install.exec
@@ -0,0 +1,6 @@
+#!/bin/bash
+if [[ TARGET_REMOTE -eq 1 ]]; then
+ ssh -p $FW_DEVICE_PORT root@$FW_DEVICE_IP "$*"
+else
+ $*
+fi
View
4 theos/bin/install.mergeDir
@@ -0,0 +1,4 @@
+#!/bin/bash
+cd $1
+# Use fakeroot.sh to ensure that permissions are preserved, and install.exec to ensure that we are running tar -x on the right system.
+fakeroot.sh -r tar -c . | install.exec tar -x -C $2
View
55 theos/bin/package_version.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+while getopts ":e:1c:" flag; do
+ case "$flag" in
+ :) echo "$0: Option -$OPTARG requires an argument." 1>&2
+ exit 1
+ ;;
+ \?) echo "$0: What're you talking about?" 1>&2
+ exit 1
+ ;;
+ e) EXTRAVERS="$OPTARG" ;;
+ c) CONTROL="$OPTARG" ;;
+ 1) SKIPONE=1 ;;
+ esac
+done
+
+if [[ -z "$CONTROL" || ! -f "$CONTROL" ]]; then
+ echo "$0: Please specify a control file with -c." 1>&2
+ exit 1;
+fi
+
+if [[ ! -d "${FW_PROJECT_DIR}/.theos/packages" ]]; then
+ if [[ -d "${FW_PROJECT_DIR}/.debmake" ]]; then
+ mkdir -p "${FW_PROJECT_DIR}/.theos"
+ mv "${FW_PROJECT_DIR}/.debmake" "${FW_PROJECT_DIR}/.theos/packages"
+ else
+ mkdir -p "${FW_PROJECT_DIR}/.theos/packages"
+ fi
+fi
+
+package=$(grep "^Package:" "$CONTROL" | cut -d' ' -f2)
+version=$(grep "^Version:" "$CONTROL" | cut -d' ' -f2)
+versionfile="${FW_PROJECT_DIR}/.theos/packages/$package-$version"
+build_number=0
+
+if [[ ! -e "$versionfile" ]]; then
+ echo -n 1 > "$versionfile"
+ build_number=1
+else
+ build_number=$(< "$versionfile")
+ let build_number++
+ echo -n "$build_number" > "$versionfile"
+fi
+
+buildno_part="-$build_number"
+if [[ $SKIPONE -eq 1 && $build_number -eq 1 ]]; then
+ buildno_part=""
+fi
+
+extra_part=""
+if [[ ! -z "$EXTRAVERS" ]]; then
+ extra_part="+$EXTRAVERS"
+fi
+
+sed -e "s/^Version: \(.*\)/Version: \1$buildno_part$extra_part/g" $CONTROL
View
0 theos/include/.keep
No changes.
View
0 theos/lib/.keep
No changes.
View
123 theos/makefiles/common.mk
@@ -0,0 +1,123 @@
+all::
+
+TOP_DIR ?= $(shell pwd)
+FW_PROJECT_DIR ?= $(TOP_DIR)
+
+ifeq ($(FRAMEWORKDIR),)
+_FW_RELATIVE_MAKE_DIR = $(dir $(lastword $(MAKEFILE_LIST)))
+FRAMEWORKDIR := $(shell (unset CDPATH; cd $(_FW_RELATIVE_MAKE_DIR); cd ..; pwd))
+ifneq ($(words $(FRAMEWORKDIR)),1) # It's a hack, but it works.
+$(shell ln -Ffs "$(FRAMEWORKDIR)" /tmp/theos)
+FRAMEWORKDIR := /tmp/theos
+endif
+endif
+FW_MAKEDIR := $(FRAMEWORKDIR)/makefiles
+FW_BINDIR := $(FRAMEWORKDIR)/bin
+FW_LIBDIR := $(FRAMEWORKDIR)/lib
+FW_INCDIR := $(FRAMEWORKDIR)/include
+FW_MODDIR := $(FRAMEWORKDIR)/mod
+export FRAMEWORKDIR FW_BINDIR FW_MAKEDIR FW_LIBDIR FW_INCDIR
+export FW_PROJECT_DIR
+
+export PATH := $(FW_BINDIR):$(PATH)
+
+# There are some packaging-related variables set here because some of the target install rules rely on them.
+ifeq ($(_FW_TOP_INVOCATION_DONE),)
+FW_HAS_LAYOUT := $(shell [ -d "$(FW_PROJECT_DIR)/layout" ] && echo 1 || echo 0)
+ifeq ($(FW_HAS_LAYOUT),1)
+ FW_PACKAGE_CONTROL_PATH := $(FW_PROJECT_DIR)/layout/DEBIAN/control
+else # FW_HAS_LAYOUT == 0
+ FW_PACKAGE_CONTROL_PATH := $(FW_PROJECT_DIR)/control
+endif # FW_HAS_LAYOUT
+FW_CAN_PACKAGE := $(shell [ -f "$(FW_PACKAGE_CONTROL_PATH)" ] && echo 1 || echo 0)
+endif # FW_TOP_INVOCATION_DONE
+
+_FW_MODULES := $(sort $(MODULES) $(THEOS_AUTOLOAD_MODULES))
+
+uname_s := $(shell uname -s)
+uname_p := $(shell uname -p)
+FW_PLATFORM_ARCH = $(uname_s)-$(uname_p)
+FW_PLATFORM = $(uname_s)
+-include $(FW_MAKEDIR)/platform/$(uname_s)-$(uname_p).mk
+-include $(FW_MAKEDIR)/platform/$(uname_s).mk
+
+_FW_TARGET := $(or $(target),$(TARGET),$(FW_PLATFORM_DEFAULT_TARGET))
+ifeq ($(_FW_TARGET),)
+$(error You did not specify a target, and the "$(FW_PLATFORM_NAME)" platform does not define a default target)
+endif
+_FW_TARGET := $(subst :, ,$(_FW_TARGET))
+_FW_TARGET_ARGS := $(wordlist 2,$(words $(_FW_TARGET)),$(_FW_TARGET))
+_FW_TARGET := $(firstword $(_FW_TARGET))
+
+-include $(FW_MAKEDIR)/targets/$(FW_PLATFORM_ARCH)/$(_FW_TARGET).mk
+-include $(FW_MAKEDIR)/targets/$(FW_PLATFORM)/$(_FW_TARGET).mk
+-include $(FW_MAKEDIR)/targets/$(_FW_TARGET).mk
+-include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/targets/$(FW_PLATFORM_ARCH)/$(_FW_TARGET).mk)
+-include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/targets/$(FW_PLATFORM)/$(_FW_TARGET).mk)
+-include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/targets/$(_FW_TARGET).mk)
+
+ifneq ($(FW_TARGET_LOADED),1)
+$(error The "$(_FW_TARGET)" target is not supported on the "$(FW_PLATFORM_NAME)" platform)
+endif
+
+_FW_TARGET_NAME_DEFINE := $(shell echo "$(FW_TARGET_NAME)" | tr 'a-z' 'A-Z')
+
+export TARGET_CC TARGET_CXX TARGET_STRIP TARGET_CODESIGN_ALLOCATE TARGET_CODESIGN TARGET_CODESIGN_FLAGS
+
+# ObjC/++ stuff is not here, it's in instance/rules.mk and only added if there are OBJC/OBJCC objects.
+INTERNAL_LDFLAGS = -L$(FW_LIBDIR)
+
+OPTFLAG ?= -O2
+DEBUGFLAG ?= -ggdb
+ifeq ($(DEBUG),1)
+DEBUG_CFLAGS = -DDEBUG $(DEBUGFLAG)
+DEBUG_LDFLAGS = $(DEBUGFLAG)
+OPTFLAG := $(filter-out -O%, $(OPTFLAG))
+TARGET_STRIP = :
+PACKAGE_BUILDNAME ?= debug
+endif
+
+INTERNAL_CFLAGS = -DTARGET_$(_FW_TARGET_NAME_DEFINE)=1 $(OPTFLAG) -I$(FW_INCDIR) -include $(FRAMEWORKDIR)/Prefix.pch -Wall
+ifneq ($(GO_EASY_ON_ME),1)
+ INTERNAL_CFLAGS += -Werror
+endif
+INTERNAL_CFLAGS += $(SHARED_CFLAGS)
+
+FW_BUILD_DIR ?= .
+
+# If we're not using the default target, put the output in a folder named after the target.
+ifneq ($(FW_TARGET_NAME),$(FW_PLATFORM_DEFAULT_TARGET))
+ FW_OBJ_DIR_NAME ?= obj/$(FW_TARGET_NAME)
+else
+ FW_OBJ_DIR_NAME ?= obj
+endif
+FW_OBJ_DIR = $(FW_BUILD_DIR)/$(FW_OBJ_DIR_NAME)
+
+FW_STAGING_DIR_NAME ?= _
+FW_STAGING_DIR = $(FW_PROJECT_DIR)/$(FW_STAGING_DIR_NAME)
+
+# $(warning ...) expands to the empty string, so the contents of FW_STAGING_DIR are not damaged in this copy.
+FW_PACKAGE_STAGING_DIR = $(FW_STAGING_DIR)$(warning FW_PACKAGE_STAGING_DIR is deprecated; please use FW_STAGING_DIR)
+
+FW_SUBPROJECT_PRODUCT = subproject.o
+
+include $(FW_MAKEDIR)/messages.mk
+ifneq ($(messages),yes)
+ FW_NO_PRINT_DIRECTORY_FLAG = --no-print-directory
+else
+ FW_NO_PRINT_DIRECTORY_FLAG =
+endif
+
+unexport FW_INSTANCE FW_TYPE
+
+ifneq ($(TARGET_CODESIGN),)
+FW_CODESIGN_COMMANDLINE = CODESIGN_ALLOCATE=$(TARGET_CODESIGN_ALLOCATE) $(TARGET_CODESIGN) $(TARGET_CODESIGN_FLAGS)
+else
+FW_CODESIGN_COMMANDLINE =
+endif
+
+FW_RSYNC_EXCLUDES := --exclude "_MTN" --exclude ".git" --exclude ".svn" --exclude ".DS_Store" --exclude "._*"
+
+FW_MAKE_PARALLEL_BUILDING ?= yes
+
+-include $(foreach mod,$(_FW_MODULES),$(FRAMEWORKDIR)/mod/$(mod)/common.mk)
View
31 theos/makefiles/instance/library.mk
@@ -0,0 +1,31 @@
+ifeq ($(FW_RULES_LOADED),)
+include $(FW_MAKEDIR)/rules.mk
+endif
+
+.PHONY: internal-library-all_ internal-library-stage_ internal-library-compile
+
+LOCAL_INSTALL_PATH ?= $(strip $($(FW_INSTANCE)_INSTALL_PATH))
+ifeq ($(LOCAL_INSTALL_PATH),)
+ LOCAL_INSTALL_PATH = /usr/lib
+endif
+
+AUXILIARY_LDFLAGS += $(call TARGET_LDFLAGS_DYNAMICLIB,$(FW_INSTANCE)$(TARGET_LIB_EXT))
+AUXILIARY_CFLAGS += $(TARGET_CFLAGS_DYNAMICLIB)
+
+ifeq ($(FW_MAKE_PARALLEL_BUILDING), no)
+internal-library-all_:: $(_OBJ_DIR_STAMPS) $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_LIB_EXT)
+else
+internal-library-all_:: $(_OBJ_DIR_STAMPS)
+ $(ECHO_NOTHING)$(MAKE) --no-print-directory --no-keep-going \
+ internal-library-compile \
+ FW_TYPE=$(FW_TYPE) FW_INSTANCE=$(FW_INSTANCE) FW_OPERATION=compile \
+ FW_BUILD_DIR="$(FW_BUILD_DIR)" _FW_MAKE_PARALLEL=yes$(ECHO_END)
+
+internal-library-compile: $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_LIB_EXT)
+endif
+
+$(eval $(call _FW_TEMPLATE_DEFAULT_LINKING_RULE,$(FW_INSTANCE)$(TARGET_LIB_EXT)))
+
+internal-library-stage_::
+ $(ECHO_NOTHING)mkdir -p "$(FW_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END)
+ $(ECHO_NOTHING)cp $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_LIB_EXT) "$(FW_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END)
View
84 theos/makefiles/instance/rules.mk
@@ -0,0 +1,84 @@
+.PHONY: before-$(FW_INSTANCE)-all after-$(FW_INSTANCE)-all internal-$(FW_TYPE)-all \
+ before-$(FW_INSTANCE)-stage after-$(FW_INSTANCE)-stage internal-$(FW_TYPE)-stage
+
+OBJ_FILES = $(strip $(patsubst %,%.o,$($(FW_INSTANCE)_FILES) $($(FW_INSTANCE)_OBJCC_FILES) $($(FW_INSTANCE)_LOGOS_FILES) $($(FW_INSTANCE)_OBJC_FILES) $($(FW_INSTANCE)_CC_FILES) $($(FW_INSTANCE)_C_FILES)))
+
+_OBJC_FILE_COUNT = $(words $(filter %.m.o %.mm.o %.xm.o,$(OBJ_FILES)))
+_OBJCC_FILE_COUNT = $(words $(filter %.mm.o %.xm.o,$(OBJ_FILES)))
+
+ifneq ($($(FW_INSTANCE)_SUBPROJECTS),)
+SUBPROJECT_OBJ_FILES = $(foreach d, $($(FW_INSTANCE)_SUBPROJECTS), $(FW_BUILD_DIR)/$(d)/$(FW_OBJ_DIR_NAME)/$(FW_SUBPROJECT_PRODUCT))
+#SUBPROJECT_OBJ_FILES = $(addsuffix /$(FW_OBJ_DIR_NAME)/$(FW_SUBPROJECT_PRODUCT), $(addprefix $(FW_BUILD_DIR)/,$($(FW_INSTANCE)_SUBPROJECTS)))
+SUBPROJECT_LDFLAGS = $(shell sort $(foreach d, $($(FW_INSTANCE)_SUBPROJECTS), $(FW_BUILD_DIR)/$(d)/$(FW_OBJ_DIR_NAME)/ldflags) | uniq)
+AUXILIARY_LDFLAGS += $(SUBPROJECT_LDFLAGS)
+endif
+
+OBJ_FILES_TO_LINK = $(strip $(addprefix $(FW_OBJ_DIR)/,$(OBJ_FILES)) $($(FW_INSTANCE)_OBJ_FILES) $(SUBPROJECT_OBJ_FILES))
+_OBJ_DIR_STAMPS = $(sort $(foreach o,$(filter $(FW_OBJ_DIR)%,$(OBJ_FILES_TO_LINK)),$(dir $o).stamp))
+
+ADDITIONAL_CPPFLAGS += $($(FW_INSTANCE)_CPPFLAGS)
+ADDITIONAL_CFLAGS += $($(FW_INSTANCE)_CFLAGS)
+ADDITIONAL_OBJCFLAGS += $($(FW_INSTANCE)_OBJCFLAGS)
+ADDITIONAL_CCFLAGS += $($(FW_INSTANCE)_CCFLAGS)
+ADDITIONAL_OBJCCFLAGS += $($(FW_INSTANCE)_OBJCCFLAGS)
+ADDITIONAL_LDFLAGS += $($(FW_INSTANCE)_LDFLAGS)
+
+# If we have any Objective-C objects, link Foundation and libobjc.
+ifneq ($(_OBJC_FILE_COUNT),0)
+ AUXILIARY_LDFLAGS += -lobjc -framework Foundation -framework CoreFoundation
+endif
+
+# In addition, if we have any Objective-C++, add the ObjC++ linker flags.
+ifneq ($(_OBJCC_FILE_COUNT),0)
+ AUXILIARY_LDFLAGS += -ObjC++ -fobjc-exceptions -fobjc-call-cxx-cdtors
+endif
+
+# Add all frameworks from the type and instance.
+AUXILIARY_LDFLAGS += $(foreach framework,$($(FW_TYPE)_FRAMEWORKS),-framework $(framework))
+AUXILIARY_LDFLAGS += $(foreach framework,$($(FW_INSTANCE)_FRAMEWORKS),-framework $(framework))
+
+# Add all private frameworks from the type and instance, as well as -F for the private framework dir.
+ifneq ($(words $($(FW_TYPE)_PRIVATE_FRAMEWORKS)$($(FW_INSTANCE)_PRIVATE_FRAMEWORKS)),0)
+ AUXILIARY_OBJCFLAGS += -F/System/Library/PrivateFrameworks
+ AUXILIARY_LDFLAGS += -F/System/Library/PrivateFrameworks
+endif
+
+AUXILIARY_LDFLAGS += $(foreach framework,$($(FW_TYPE)_PRIVATE_FRAMEWORKS),-framework $(framework))
+AUXILIARY_LDFLAGS += $(foreach framework,$($(FW_INSTANCE)_PRIVATE_FRAMEWORKS),-framework $(framework))
+
+before-$(FW_INSTANCE)-all::
+
+after-$(FW_INSTANCE)-all::
+
+internal-$(FW_TYPE)-all:: before-$(FW_INSTANCE)-all internal-$(FW_TYPE)-all_ after-$(FW_INSTANCE)-all
+
+before-$(FW_INSTANCE)-stage::
+
+after-$(FW_INSTANCE)-stage::
+
+internal-$(FW_TYPE)-stage:: before-$(FW_INSTANCE)-stage internal-$(FW_TYPE)-stage_ after-$(FW_INSTANCE)-stage
+
+define _FW_TEMPLATE_DEFAULT_LINKING_RULE
+$$(FW_OBJ_DIR)/$(1): $$(OBJ_FILES_TO_LINK)
+ifeq ($$(OBJ_FILES_TO_LINK),)
+ $$(WARNING_EMPTY_LINKING)
+endif
+ $$(ECHO_LINKING)$$(TARGET_CXX) $$(ALL_LDFLAGS) -o $$@ $$^$$(ECHO_END)
+ifeq ($$(DEBUG),)
+ $$(ECHO_STRIPPING)$$(TARGET_STRIP) $$(TARGET_STRIP_FLAGS) $$@$$(ECHO_END)
+endif
+ifneq ($$(FW_CODESIGN_COMMANDLINE),)
+ $$(ECHO_SIGNING)$$(FW_CODESIGN_COMMANDLINE) $$@$$(ECHO_END)
+endif
+endef
+
+define _FW_TEMPLATE_NOWARNING_LINKING_RULE
+$$(FW_OBJ_DIR)/$(1): $$(OBJ_FILES_TO_LINK)
+ $$(ECHO_LINKING)$$(TARGET_CXX) $$(ALL_LDFLAGS) -o $$@ $$^$$(ECHO_END)
+ifeq ($$(DEBUG),)
+ $$(ECHO_STRIPPING)$$(TARGET_STRIP) $$(TARGET_STRIP_FLAGS) $$@$$(ECHO_END)
+endif
+ifneq ($$(FW_CODESIGN_COMMANDLINE),)
+ $$(ECHO_SIGNING)$$(FW_CODESIGN_COMMANDLINE) $$@$$(ECHO_END)
+endif
+endef
View
31 theos/makefiles/instance/tool.mk
@@ -0,0 +1,31 @@
+ifeq ($(FW_RULES_LOADED),)
+include $(FW_MAKEDIR)/rules.mk
+endif
+
+.PHONY: internal-tool-all_ internal-tool-stage_ internal-tool-compile
+
+ifeq ($(FW_MAKE_PARALLEL_BUILDING), no)
+internal-tool-all_:: $(_OBJ_DIR_STAMPS) $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_EXE_EXT)
+else
+internal-tool-all_:: $(_OBJ_DIR_STAMPS)
+ $(ECHO_NOTHING)$(MAKE) --no-print-directory --no-keep-going \
+ internal-tool-compile \
+ FW_TYPE=$(FW_TYPE) FW_INSTANCE=$(FW_INSTANCE) FW_OPERATION=compile \
+ FW_BUILD_DIR="$(FW_BUILD_DIR)" _FW_MAKE_PARALLEL=yes$(ECHO_END)
+
+internal-tool-compile: $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_EXE_EXT)
+endif
+
+$(eval $(call _FW_TEMPLATE_DEFAULT_LINKING_RULE,$(FW_INSTANCE)$(TARGET_EXE_EXT)))
+
+LOCAL_INSTALL_PATH = $(strip $($(FW_INSTANCE)_INSTALL_PATH))
+ifeq ($(LOCAL_INSTALL_PATH),)
+ LOCAL_INSTALL_PATH = $($(FW_INSTANCE)_PACKAGE_TARGET_DIR)
+ ifeq ($(LOCAL_INSTALL_PATH),)
+ LOCAL_INSTALL_PATH = /usr/bin
+ endif
+endif
+
+internal-tool-stage_::
+ $(ECHO_NOTHING)mkdir -p "$(FW_STAGING_DIR)$(LOCAL_INSTALL_PATH)"$(ECHO_END)
+ $(ECHO_NOTHING)cp $(FW_OBJ_DIR)/$(FW_INSTANCE)$(TARGET_EXE_EXT) "$(FW_STAGING_DIR)$(LOCAL_INSTALL_PATH)"$(ECHO_END)
View
7 theos/makefiles/library.mk
@@ -0,0 +1,7 @@
+ifeq ($(FW_INSTANCE),)
+ include $(FW_MAKEDIR)/master/library.mk
+else
+ ifeq ($(FW_TYPE),library)
+ include $(FW_MAKEDIR)/instance/library.mk
+ endif
+endif
View
17 theos/makefiles/master/library.mk
@@ -0,0 +1,17 @@
+LIBRARY_NAME := $(strip $(LIBRARY_NAME))
+
+ifeq ($(FW_RULES_LOADED),)
+include $(FW_MAKEDIR)/rules.mk
+endif
+
+internal-all:: $(LIBRARY_NAME:=.all.library.variables);
+
+internal-stage:: $(LIBRARY_NAME:=.stage.library.variables);
+
+LIBRARYS_WITH_SUBPROJECTS = $(strip $(foreach library,$(LIBRARY_NAME),$(patsubst %,$(library),$($(library)_SUBPROJECTS))))
+ifneq ($(LIBRARYS_WITH_SUBPROJECTS),)
+internal-clean:: $(LIBRARYS_WITH_SUBPROJECTS:=.clean.library.subprojects)
+endif
+
+$(LIBRARY_NAME):
+ @$(MAKE) --no-print-directory --no-keep-going $@.all.library.variables
View
99 theos/makefiles/master/rules.mk
@@ -0,0 +1,99 @@
+.PHONY: all before-all internal-all after-all \
+ clean before-clean internal-clean after-clean
+ifeq ($(FW_BUILD_DIR),.)
+all:: before-all internal-all after-all
+else
+all:: $(FW_BUILD_DIR) before-all internal-all after-all
+endif
+
+clean:: before-clean internal-clean after-clean
+
+before-all::
+ifneq ($(SYSROOT),)
+ @[ -d "$(SYSROOT)" ] || { echo "Your current SYSROOT, \"$(SYSROOT)\", appears to be missing."; exit 1; }
+endif
+
+internal-all::
+
+after-all::
+
+before-clean::
+
+internal-clean::
+ rm -rf $(FW_OBJ_DIR)
+ifeq ($(MAKELEVEL),0)
+ rm -rf "$(FW_STAGING_DIR)"
+endif
+
+after-clean::
+
+include $(FW_MAKEDIR)/package.mk
+
+ifeq ($(MAKELEVEL),0)
+ifneq ($(FW_BUILD_DIR),.)
+ABS_FW_BUILD_DIR = $(shell (unset CDPATH; cd "$(FW_BUILD_DIR)"; pwd))
+else
+ABS_FW_BUILD_DIR = .
+endif
+else
+ABS_FW_BUILD_DIR = $(strip $(FW_BUILD_DIR))
+endif
+
+ifeq ($(_FW_TOP_INVOCATION_DONE),)
+export _FW_TOP_INVOCATION_DONE = 1
+endif
+
+.PRECIOUS: %.variables %.subprojects
+
+%.variables:
+ @ \
+instance=$(basename $(basename $*)); \
+operation=$(subst .,,$(suffix $(basename $*))); \
+type=$(subst -,_,$(subst .,,$(suffix $*))); \
+abs_build_dir=$(ABS_FW_BUILD_DIR); \
+if [ "$($(basename $(basename $*))_SUBPROJECTS)" != "" ]; then \
+ echo Making $$operation in subprojects of $$type $$instance...; \
+ for d in $($(basename $(basename $*))_SUBPROJECTS); do \
+ if [ "$${abs_build_dir}" = "." ]; then \
+ lbuilddir="."; \
+ else \
+ lbuilddir="$${abs_build_dir}/$$d"; \
+ fi; \
+ if $(MAKE) -C $$d $(FW_NO_PRINT_DIRECTORY_FLAG) --no-keep-going $$operation \
+ FW_BUILD_DIR="$$lbuilddir" \
+ ; then\
+ :; \
+ else exit $$?; \
+ fi; \
+ done; \
+ fi; \
+echo Making $$operation for $$type $$instance...; \
+$(MAKE) --no-print-directory --no-keep-going \
+ internal-$${type}-$$operation \
+ FW_TYPE=$$type \
+ FW_INSTANCE=$$instance \
+ FW_OPERATION=$$operation \
+ FW_BUILD_DIR=$$abs_build_dir
+
+%.subprojects:
+ @ \
+instance=$(basename $(basename $*)); \
+operation=$(subst .,,$(suffix $(basename $*))); \
+type=$(subst -,_,$(subst .,,$(suffix $*))); \
+abs_build_dir=$(ABS_FW_BUILD_DIR); \
+if [ "$($(basename $(basename $*))_SUBPROJECTS)" != "" ]; then \
+ echo Making $$operation in subprojects of $$type $$instance...; \
+ for d in $($(basename $(basename $*))_SUBPROJECTS); do \
+ if [ "$${abs_build_dir}" = "." ]; then \
+ lbuilddir="."; \
+ else \
+ lbuilddir="$${abs_build_dir}/$$d"; \
+ fi; \
+ if $(MAKE) -C $$d $(FW_NO_PRINT_DIRECTORY_FLAG) --no-keep-going $$operation \
+ FW_BUILD_DIR="$$lbuilddir" \
+ ; then\
+ :; \
+ else exit $$?; \
+ fi; \
+ done; \
+ fi
View
17 theos/makefiles/master/tool.mk
@@ -0,0 +1,17 @@
+TOOL_NAME := $(strip $(TOOL_NAME))
+
+ifeq ($(FW_RULES_LOADED),)
+include $(FW_MAKEDIR)/rules.mk
+endif
+
+internal-all:: $(TOOL_NAME:=.all.tool.variables);
+
+internal-stage:: $(TOOL_NAME:=.stage.tool.variables);
+
+TOOLS_WITH_SUBPROJECTS = $(strip $(foreach tool,$(TOOL_NAME),$(patsubst %,$(tool),$($(tool)_SUBPROJECTS))))
+ifneq ($(TOOLS_WITH_SUBPROJECTS),)
+internal-clean:: $(TOOLS_WITH_SUBPROJECTS:=.clean.tool.subprojects)
+endif
+
+$(TOOL_NAME):
+ @$(MAKE) --no-print-directory --no-keep-going $@.all.tool.variables
View
30 theos/makefiles/messages.mk
@@ -0,0 +1,30 @@
+ifneq ($(messages),yes)
+ ECHO_COMPILING = @(echo " Compiling $<...";
+ ECHO_LINKING = @(echo " Linking $(FW_TYPE) $(FW_INSTANCE)...";
+ ECHO_STRIPPING = @(echo " Stripping $(FW_INSTANCE)...";
+ ECHO_SIGNING = @(echo " Signing $(FW_INSTANCE)...";
+ ECHO_LOGOS = @(echo " Preprocessing $<...";
+ ECHO_COPYING_RESOURCE_FILES = @(echo " Copying resource files into the $(FW_TYPE) wrapper...";
+ ECHO_COPYING_RESOURCE_DIRS = @(echo " Copying resource directories into the $(FW_TYPE) wrapper...";
+ ECHO_NOTHING = @(
+
+ STDERR_NULL_REDIRECT = 2> /dev/null
+
+ ECHO_END = )
+else
+ ECHO_COMPILING =
+ ECHO_LINKING =
+ ECHO_STRIPPING =
+ ECHO_SIGNING =
+ ECHO_LOGOS =
+ ECHO_COPYING_RESOURCE_FILES =
+ ECHO_COPYING_RESOURCE_DIRS =
+ ECHO_NOTHING =
+ STDERR_NULL_REDIRECT =
+ ECHO_END =
+endif
+
+WARNING_EMPTY_LINKING = @(echo " Warning! No files to link. Please check your Makefile! Make sure you set $(FW_INSTANCE)_OBJC_FILES (or similar variables)")
+
+# (bundle)
+NOTICE_EMPTY_LINKING = @(echo " Notice: No files to link - creating a bundle containing only resources")
View
77 theos/makefiles/package.mk
@@ -0,0 +1,77 @@
+ifeq ($(FW_PACKAGING_RULES_LOADED),)
+FW_PACKAGING_RULES_LOADED := 1
+
+.PHONY: package before-package internal-package after-package-buildno after-package \
+ stage before-stage internal-stage after-stage
+
+# For the toplevel invocation of make, mark 'all' and the *-package rules as prerequisites.
+# We do not do this for anything else, because otherwise, all the packaging rules would run for every subproject.
+ifeq ($(_FW_TOP_INVOCATION_DONE),)
+stage:: all before-stage internal-stage after-stage
+
+_FW_HAS_DPKG_DEB := $(shell type dpkg-deb > /dev/null 2>&1 && echo 1 || echo 0)
+ifeq ($(_FW_HAS_DPKG_DEB),1)
+package:: stage package-build-deb
+else # _FW_HAS_DPKG_DEB == 0
+package::
+ @echo "$(MAKE) package requires dpkg-deb."; exit 1
+endif
+
+install:: before-install internal-install after-install
+else # _FW_TOP_INVOCATION_DONE
+stage:: internal-stage
+package::
+install::
+endif
+
+FAKEROOT := $(FW_BINDIR)/fakeroot.sh -p "$(FW_PROJECT_DIR)/.theos/fakeroot"
+export FAKEROOT
+
+# Only do the master packaging rules if we're the toplevel make invocation.
+ifeq ($(_FW_TOP_INVOCATION_DONE),)
+before-stage::
+ $(ECHO_NOTHING)rm -rf "$(FW_STAGING_DIR)"$(ECHO_END)
+ $(ECHO_NOTHING)$(FAKEROOT) -c$(ECHO_END)
+ $(ECHO_NOTHING)mkdir -p "$(FW_STAGING_DIR)"$(ECHO_END)
+
+ifeq ($(FW_CAN_PACKAGE),1) # Control file found (or layout/ found.)
+
+FW_PACKAGE_NAME := $(shell grep "^Package:" "$(FW_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2)
+FW_PACKAGE_ARCH := $(shell grep "^Architecture:" "$(FW_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2)
+FW_PACKAGE_VERSION := $(shell grep "^Version:" "$(FW_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2)
+
+FW_PACKAGE_DEBVERSION = $(shell grep "^Version:" "$(FW_STAGING_DIR)/DEBIAN/control" | cut -d' ' -f2)
+
+FW_PACKAGE_FILENAME = $(FW_PACKAGE_NAME)_$(FW_PACKAGE_DEBVERSION)_$(FW_PACKAGE_ARCH)
+
+package-build-deb-buildno::
+ $(ECHO_NOTHING)mkdir -p $(FW_STAGING_DIR)/DEBIAN$(ECHO_END)
+ifeq ($(FW_HAS_LAYOUT),1) # If we have a layout/ directory, copy layout/DEBIAN to the staging directory.
+ $(ECHO_NOTHING)rsync -a "$(FW_PROJECT_DIR)/layout/DEBIAN/" "$(FW_STAGING_DIR)/DEBIAN" $(FW_RSYNC_EXCLUDES)$(ECHO_END)
+endif # FW_HAS_LAYOUT
+ $(ECHO_NOTHING)$(FW_BINDIR)/package_version.sh -c "$(FW_PACKAGE_CONTROL_PATH)" $(if $(PACKAGE_BUILDNAME),-e $(PACKAGE_BUILDNAME),) > "$(FW_STAGING_DIR)/DEBIAN/control"$(ECHO_END)
+ $(ECHO_NOTHING)echo "Installed-Size: $(shell du $(DU_EXCLUDE) DEBIAN -ks "$(FW_STAGING_DIR)" | cut -f 1)" >> "$(FW_STAGING_DIR)/DEBIAN/control"$(ECHO_END)
+
+package-build-deb:: package-build-deb-buildno
+ $(ECHO_NOTHING)$(FAKEROOT) -r dpkg-deb -b "$(FW_STAGING_DIR)" "$(FW_PROJECT_DIR)/$(FW_PACKAGE_FILENAME).deb" $(STDERR_NULL_REDIRECT)$(ECHO_END)
+
+else # FW_CAN_PACKAGE == 0
+package-build-deb::
+ @echo "$(MAKE) package requires you to have a layout/ directory in the project root, containing the basic package structure, or a control file in the project root describing the package."; exit 1
+
+endif # FW_CAN_PACKAGE
+
+endif # _FW_TOP_INVOCATION_DONE
+
+# *-stage calls *-package for backwards-compatibility.
+internal-package after-package::
+internal-stage:: internal-package
+ $(ECHO_NOTHING)[ -d layout ] && rsync -a "layout/" "$(FW_STAGING_DIR)" --exclude "DEBIAN" $(FW_RSYNC_EXCLUDES) || true$(ECHO_END)
+
+after-stage:: after-package
+
+before-install::
+after-install:: internal-after-install
+internal-after-install::
+
+endif # FW_PACKAGING_RULES_LOADED
View
7 theos/makefiles/platform/Darwin-arm.mk
@@ -0,0 +1,7 @@
+ifeq ($(FW_PLATFORM_LOADED),)
+FW_PLATFORM_LOADED := 1
+FW_PLATFORM_NAME := iphone
+
+FW_PLATFORM_DEFAULT_TARGET := iphone
+DU_EXCLUDE = --exclude
+endif
View
7 theos/makefiles/platform/Darwin.mk
@@ -0,0 +1,7 @@
+ifeq ($(FW_PLATFORM_LOADED),)
+FW_PLATFORM_LOADED := 1
+FW_PLATFORM_NAME := macosx
+
+FW_PLATFORM_DEFAULT_TARGET := iphone
+DU_EXCLUDE = -I
+endif
View
7 theos/makefiles/platform/Linux.mk
@@ -0,0 +1,7 @@
+ifeq ($(FW_PLATFORM_LOADED),)
+FW_PLATFORM_LOADED := 1
+FW_PLATFORM_NAME := linux
+
+FW_PLATFORM_DEFAULT_TARGET := iphone
+DU_EXCLUDE = --exclude
+endif
View
87 theos/makefiles/rules.mk
@@ -0,0 +1,87 @@
+ifeq ($(FW_RULES_LOADED),)
+FW_RULES_LOADED := 1
+
+ifeq ($(FW_INSTANCE),)
+ include $(FW_MAKEDIR)/master/rules.mk
+ -include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/master/rules.mk)
+else
+ include $(FW_MAKEDIR)/instance/rules.mk
+ -include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/instance/rules.mk)
+endif
+
+ALL_CFLAGS = $(INTERNAL_CFLAGS) $(TARGET_CFLAGS) $(ADDITIONAL_CFLAGS) $(AUXILIARY_CFLAGS) $(DEBUG_CFLAGS) $(CFLAGS)
+ALL_CCFLAGS = $(ADDITIONAL_CCFLAGS) $(CCFLAGS)
+ALL_OBJCFLAGS = $(INTERNAL_OBJCFLAGS) $(TARGET_OBJCFLAGS) $(ADDITIONAL_OBJCFLAGS) $(AUXILIARY_OBJCFLAGS) $(DEBUG_CFLAGS) $(OBJCFLAGS)
+ALL_OBJCCFLAGS = $(ADDITIONAL_OBJCCFLAGS) $(OBJCCFLAGS)
+
+ALL_LDFLAGS = $(INTERNAL_LDFLAGS) $(ADDITIONAL_LDFLAGS) $(AUXILIARY_LDFLAGS) $(TARGET_LDFLAGS) $(DEBUG_LDFLAGS) $(LDFLAGS)
+
+ifeq ($(FW_MAKE_PARALLEL_BUILDING), no)
+.NOTPARALLEL:
+else
+ifneq ($(_FW_MAKE_PARALLEL), yes)
+.NOTPARALLEL:
+endif
+endif
+
+.SUFFIXES:
+
+.SUFFIXES: .m .mm .c .cc .cpp .xm
+
+$(FW_OBJ_DIR)/%.m.o: %.m
+ $(ECHO_COMPILING)$(TARGET_CXX) -x objective-c -c $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $< -o $@$(ECHO_END)
+
+$(FW_OBJ_DIR)/%.mm.o: %.mm
+ $(ECHO_COMPILING)$(TARGET_CXX) -c $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $< -o $@$(ECHO_END)
+
+$(FW_OBJ_DIR)/%.c.o: %.c
+ $(ECHO_COMPILING)$(TARGET_CXX) -x c -c $(ALL_CFLAGS) $< -o $@$(ECHO_END)
+
+$(FW_OBJ_DIR)/%.cc.o: %.cc
+ $(ECHO_COMPILING)$(TARGET_CXX) -c $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
+
+$(FW_OBJ_DIR)/%.cpp.o: %.cpp
+ $(ECHO_COMPILING)$(TARGET_CXX) -c $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
+
+$(FW_OBJ_DIR)/%.xm.o: %.xm
+ $(ECHO_LOGOS)$(FW_BINDIR)/logos.pl $< > $(FW_OBJ_DIR)/$<.mm$(ECHO_END)
+ $(ECHO_COMPILING)$(TARGET_CXX) -c -I"$(shell pwd)" $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $(FW_OBJ_DIR)/$<.mm -o $@$(ECHO_END)
+ $(ECHO_NOTHING)rm $(FW_OBJ_DIR)/$<.mm$(ECHO_END)
+
+%.mm: %.l.mm
+ $(FW_BINDIR)/logos.pl $< > $@
+
+%.mm: %.xmm
+ $(FW_BINDIR)/logos.pl $< > $@
+
+%.mm: %.xm
+ $(FW_BINDIR)/logos.pl $< > $@
+
+%.m: %.xm
+ $(FW_BINDIR)/logos.pl $< > $@
+
+ifneq ($(FW_BUILD_DIR),.)
+$(FW_BUILD_DIR):
+ @mkdir -p $(FW_BUILD_DIR)
+endif
+
+$(FW_OBJ_DIR):
+ @cd $(FW_BUILD_DIR); mkdir -p $(FW_OBJ_DIR_NAME)
+
+$(FW_OBJ_DIR)/.stamp: $(FW_OBJ_DIR)
+ @touch $@
+
+$(FW_OBJ_DIR)/%/.stamp: $(FW_OBJ_DIR)
+ @mkdir -p $(dir $@); touch $@
+
+Makefile: ;
+framework/makefiles/*.mk: ;
+$(FW_MAKEDIR)/*.mk: ;
+$(FW_MAKEDIR)/master/*.mk: ;
+$(FW_MAKEDIR)/instance/*.mk: ;
+$(FW_MAKEDIR)/platform/*.mk: ;
+
+endif
+
+# TODO MAKE A BUNCH OF THINGS PHONY
+-include $(foreach mod,$(_FW_MODULES),$(FW_MODDIR)/$(mod)/rules.mk)
View
25 theos/makefiles/targets/Darwin-arm/iphone.mk
@@ -0,0 +1,25 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := iphone
+
+SDKTARGET ?= arm-apple-darwin9
+SDKBINPATH ?= /usr/bin
+SYSROOT ?= /var/sdk
+
+PREFIX := $(SDKBINPATH)/$(SDKTARGET)-
+
+TARGET_CC ?= $(PREFIX)gcc
+TARGET_CXX ?= $(PREFIX)g++
+TARGET_STRIP ?= strip
+TARGET_STRIP_FLAGS ?= -x
+TARGET_CODESIGN_ALLOCATE ?= codesign_allocate
+TARGET_CODESIGN ?= ldid
+TARGET_CODESIGN_FLAGS ?= -S
+
+include $(FW_MAKEDIR)/targets/_common/install_deb_local.mk
+include $(FW_MAKEDIR)/targets/_common/darwin.mk
+
+SDKFLAGS := -isysroot $(SYSROOT)
+TARGET_CFLAGS := $(SDKFLAGS)
+TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress
+endif
View
1 theos/makefiles/targets/Darwin-arm/native.mk
View
29 theos/makefiles/targets/Darwin/iphone.mk
@@ -0,0 +1,29 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := iphone
+
+SDKBINPATH ?= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
+ifneq ($(words $(_FW_TARGET_ARGS)),0)
+# A version specified as a target argument overrides all previous definitions.
+override SDKVERSION := $(firstword $(_FW_TARGET_ARGS))
+else
+SDKVERSION ?= 3.0
+endif
+SYSROOT ?= /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(SDKVERSION).sdk
+
+TARGET_CC ?= $(SDKBINPATH)/gcc-4.2
+TARGET_CXX ?= $(SDKBINPATH)/g++-4.2
+TARGET_STRIP ?= $(SDKBINPATH)/strip
+TARGET_STRIP_FLAGS ?= -x
+TARGET_CODESIGN_ALLOCATE ?= $(SDKBINPATH)/codesign_allocate
+TARGET_CODESIGN ?= ldid
+TARGET_CODESIGN_FLAGS ?= -S
+
+include $(FW_MAKEDIR)/targets/_common/install_deb_remote.mk
+include $(FW_MAKEDIR)/targets/_common/darwin.mk
+
+ARCHS ?= armv6
+SDKFLAGS := -isysroot $(SYSROOT) $(foreach ARCH,$(ARCHS),-arch $(ARCH)) -D__IPHONE_OS_VERSION_MIN_REQUIRED=__IPHONE_$(subst .,_,$(SDKVERSION))
+TARGET_CFLAGS := $(SDKFLAGS)
+TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress
+endif
View
22 theos/makefiles/targets/Darwin/macosx.mk
@@ -0,0 +1,22 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := macosx
+
+SDKBINPATH ?= /usr/bin
+
+TARGET_CC ?= $(SDKBINPATH)/gcc-4.2
+TARGET_CXX ?= $(SDKBINPATH)/g++-4.2
+TARGET_STRIP ?= $(SDKBINPATH)/strip
+TARGET_STRIP_FLAGS ?= -x
+TARGET_CODESIGN_ALLOCATE ?= $(SDKBINPATH)/codesign_allocate
+TARGET_CODESIGN ?=
+TARGET_CODESIGN_FLAGS ?=
+
+include $(FW_MAKEDIR)/targets/_common/install_deb_local.mk
+include $(FW_MAKEDIR)/targets/_common/darwin.mk
+
+ARCHS ?= i386 x86_64
+SDKFLAGS := $(foreach ARCH,$(ARCHS),-arch $(ARCH))
+TARGET_CFLAGS := $(SDKFLAGS)
+TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress
+endif
View
1 theos/makefiles/targets/Darwin/native.mk
View
37 theos/makefiles/targets/Darwin/simulator.mk
@@ -0,0 +1,37 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := iphone_simulator
+
+SDKBINPATH ?= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin
+ifneq ($(words $(_FW_TARGET_ARGS)),0)
+# A version specified as a target argument overrides all previous definitions.
+override SDKVERSION := $(firstword $(_FW_TARGET_ARGS))
+else
+SDKVERSION ?= 3.0
+endif
+SYSROOT ?= /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$(SDKVERSION).sdk
+
+TARGET_CC ?= $(SDKBINPATH)/gcc-4.2
+TARGET_CXX ?= $(SDKBINPATH)/g++-4.2
+TARGET_STRIP ?= $(SDKBINPATH)/strip
+TARGET_STRIP_FLAGS ?= -x
+TARGET_CODESIGN_ALLOCATE ?= $(SDKBINPATH)/codesign_allocate
+TARGET_CODESIGN ?=
+TARGET_CODESIGN_FLAGS ?=
+
+include $(FW_MAKEDIR)/targets/_common/darwin.mk
+
+ifeq ($(IPHONE_SIMULATOR_ROOT),)
+internal-install::
+ $(info $(MAKE) install for the simulator requires that you set IPHONE_SIMULATOR_ROOT to the root directory of the simulated OS.)
+ @exit 1
+else
+internal-install:: stage
+ install.mergeDir "$(FW_STAGING_DIR)" "$(IPHONE_SIMULATOR_ROOT)"
+endif
+
+ARCHS ?= i386
+SDKFLAGS := -isysroot $(SYSROOT) $(foreach ARCH,$(ARCHS),-arch $(ARCH)) -D__IPHONE_OS_VERSION_MIN_REQUIRED=__IPHONE_$(subst .,_,$(SDKVERSION))
+TARGET_CFLAGS := $(SDKFLAGS)
+TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress -mmacosx-version-min=10.5
+endif
View
25 theos/makefiles/targets/Linux/iphone.mk
@@ -0,0 +1,25 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := iphone
+
+SDKTARGET ?= arm-apple-darwin9
+SDKBINPATH ?= /opt/iphone-sdk-3.0/prefix/bin
+SYSROOT ?= /opt/iphone-sdk-3.0/sysroot
+
+PREFIX := $(SDKBINPATH)/$(SDKTARGET)-
+
+TARGET_CC ?= $(PREFIX)gcc
+TARGET_CXX ?= $(PREFIX)g++
+TARGET_STRIP ?= $(PREFIX)strip
+TARGET_STRIP_FLAGS ?= -x
+TARGET_CODESIGN_ALLOCATE ?= $(PREFIX)codesign_allocate
+TARGET_CODESIGN ?= ldid
+TARGET_CODESIGN_FLAGS ?= -S
+
+include $(FW_MAKEDIR)/targets/_common/install_deb_remote.mk
+include $(FW_MAKEDIR)/targets/_common/darwin.mk
+
+SDKFLAGS := -isysroot $(SYSROOT)
+TARGET_CFLAGS := $(SDKFLAGS)
+TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress
+endif
View
20 theos/makefiles/targets/Linux/linux.mk
@@ -0,0 +1,20 @@
+ifeq ($(FW_TARGET_LOADED),)
+FW_TARGET_LOADED := 1
+FW_TARGET_NAME := linux
+
+ifneq ($(words $(_FW_TARGET_ARGS)),0)
+CROSS_COMPILE := $(firstword $(_FW_TARGET_ARGS))-
+endif
+
+TARGET_CC ?= $(CROSS_COMPILE)gcc
+TARGET_CXX ?= $(CROSS_COMPILE)g++
+TARGET_STRIP ?= $(CROSS_COMPILE)strip
+TARGET_STRIP_FLAGS ?=
+TARGET_CODESIGN_ALLOCATE ?=
+TARGET_CODESIGN ?=
+TARGET_CODESIGN_FLAGS ?=
+
+include $(FW_MAKEDIR)/targets/_common/linux.mk
+
+SDKFLAGS :=
+endif
View
1 theos/makefiles/targets/Linux/native.mk
View
6 theos/makefiles/targets/_common/darwin.mk
@@ -0,0 +1,6 @@
+# Variables that are common to all Darwin-based targets.
+TARGET_EXE_EXT =
+TARGET_LIB_EXT = .dylib
+
+TARGET_LDFLAGS_DYNAMICLIB = -dynamiclib -install_name $(LOCAL_INSTALL_PATH)/$(1)
+TARGET_CFLAGS_DYNAMICLIB =
View
9 theos/makefiles/targets/_common/install_deb_local.mk
@@ -0,0 +1,9 @@
+export TARGET_REMOTE := 0
+
+ifeq ($(FW_CAN_PACKAGE),1)
+internal-install::
+ install.exec "dpkg -i $(FW_PACKAGE_FILENAME).deb"
+else # FW_CAN_PACKAGE
+internal-install:: stage
+ install.mergeDir "$(FW_STAGING_DIR)" "/"
+endif
View
22 theos/makefiles/targets/_common/install_deb_remote.mk
@@ -0,0 +1,22 @@
+export TARGET_REMOTE := 1
+
+ifeq ($(FW_DEVICE_IP),)
+internal-install::
+ $(info $(MAKE) install requires that you set FW_DEVICE_IP in your environment. It is also recommended that you have public-key authentication set up for root over SSH, or you'll be entering your password a lot.)
+ @exit 1
+else # FW_DEVICE_IP
+
+FW_DEVICE_PORT ?= 22
+
+export FW_DEVICE_IP FW_DEVICE_PORT
+
+ifeq ($(FW_CAN_PACKAGE),1)
+internal-install::
+ install.copyFile "$(FW_PROJECT_DIR)/$(FW_PACKAGE_FILENAME).deb" "$(FW_PACKAGE_FILENAME).deb"
+ install.exec "dpkg -i $(FW_PACKAGE_FILENAME).deb"
+else # FW_CAN_PACKAGE == 0
+internal-install:: stage
+ install.mergeDir "$(FW_STAGING_DIR)" "/"
+endif # FW_CAN_PACKAGE
+
+endif # FW_DEVICE_IP
View
6 theos/makefiles/targets/_common/linux.mk
@@ -0,0 +1,6 @@
+# Variables that are common to all Linux-based targets.
+TARGET_EXE_EXT =
+TARGET_LIB_EXT = .so
+
+TARGET_LDFLAGS_DYNAMICLIB = -shared -Wl,-soname,$(1)
+TARGET_CFLAGS_DYNAMICLIB = -fPIC
View
7 theos/makefiles/tool.mk
@@ -0,0 +1,7 @@
+ifeq ($(FW_INSTANCE),)
+ include $(FW_MAKEDIR)/master/tool.mk
+else
+ ifeq ($(FW_TYPE),tool)
+ include $(FW_MAKEDIR)/instance/tool.mk
+ endif
+endif

0 comments on commit c8d95f8

Please sign in to comment.