# $Id: 3rdparty.mk 6210 2007-03-23 23:33:42Z mthuurne $ # # Compiles 3rd party libraries needed by openMSX. # Actually, only those 3rd party libraries that are not in the default system # of Mac OS X, but others can be added later. # It enables only the features needed by openMSX: for example from SDL_image # we only need PNG handling cability. ifeq ($(origin BUILD_PATH),undefined) $(error You should pass BUILD_PATH) endif # Compiler selection, compiler flags, SDK selection. # These variables are already exported, but we make it explicit here. export CC export LD export NEXT_ROOT TARBALLS_DIR:=derived/3rdparty/download SOURCE_DIR:=derived/3rdparty/src PATCHES_DIR:=build/3rdparty TIMESTAMP_DIR:=$(BUILD_PATH)/timestamps BUILD_DIR:=$(BUILD_PATH)/build INSTALL_DIR:=$(BUILD_PATH)/install # Download locations for package sources. DOWNLOAD_PNG:=ftp://ftp.simplesystems.org/pub/libpng/png/src DOWNLOAD_SDL:=http://www.libsdl.org/release DOWNLOAD_SDL_IMAGE:=http://www.libsdl.org/projects/SDL_image/release DOWNLOAD_GLEW:=http://downloads.sourceforge.net/glew # These were the most recent versions at the moment of writing this Makefile. # You can use other versions if you like; adjust the names accordingly. PACKAGE_PNG:=libpng-1.2.16 PACKAGE_SDL:=SDL-1.2.11 PACKAGE_SDL_IMAGE:=SDL_image-1.2.5 PACKAGE_GLEW:=glew-1.3.6 # Unfortunately not all packages stick to naming conventions such as putting # the sources in a dir that includes the version number. PACKAGES_STD:=PNG SDL SDL_IMAGE PACKAGES_NONSTD:=GLEW PACKAGES:=$(PACKAGES_STD) $(PACKAGES_NONSTD) # Source tar file names for non-standard packages. TARBALL_GLEW:=$(PACKAGE_GLEW)-src.tgz # Source tar file names for standard packages. TARBALL_PNG:=$(PACKAGE_PNG).tar.gz TARBALL_SDL:=$(PACKAGE_SDL).tar.gz TARBALL_SDL_IMAGE:=$(PACKAGE_SDL_IMAGE).tar.gz # All source tar file names. TARBALLS:=$(foreach PACKAGE,$(PACKAGES),$(TARBALL_$(PACKAGE))) BUILD_TARGETS:=$(foreach PACKAGE,$(PACKAGES),$(TIMESTAMP_DIR)/build-$(PACKAGE_$(PACKAGE))) INSTALL_TARGETS:=$(foreach PACKAGE,$(PACKAGES),$(TIMESTAMP_DIR)/install-$(PACKAGE_$(PACKAGE))) INSTALL_PARAMS_GLEW:=GLEW_DEST=$(PWD)/$(INSTALL_DIR) # Function which, given a variable name prefix and the variable's value, # returns the name of the package. findpackage=$(strip $(foreach PACKAGE,$(PACKAGES),$(if $(filter $(2),$($(1)_$(PACKAGE))),$(PACKAGE),))) .PHONY: all clean download all: $(INSTALL_TARGETS) clean: rm -rf $(SOURCE_DIR) rm -rf $(BUILD_DIR) rm -rf $(INSTALL_DIR) # Install. $(INSTALL_TARGETS): $(TIMESTAMP_DIR)/install-%: $(TIMESTAMP_DIR)/build-% make -C $(BUILD_DIR)/$* install $(INSTALL_PARAMS_$(call findpackage,PACKAGE,$*)) mkdir -p $(@D) touch $@ # Build. $(BUILD_TARGETS): $(TIMESTAMP_DIR)/build-%: $(BUILD_DIR)/%/Makefile make -C $(