blob: e0e17b648cbd3368bcbb477c7d4f972bc2036503 [file] [log] [blame]
#
# Copyright (c) 2011-2012 Nest Labs, Inc.
# All rights reserved.
#
# This document is the property of Nest. It is considered
# confidential and proprietary information.
#
# This document may not be reproduced or transmitted in any form,
# in whole or in part, without the express written permission of
# Nest.
#
# Description:
# This file is the makefile for lp_solve, a linear and mixed
# integer program solver.
#
BuildConfigSpecialized := No
BuildProductSpecialized := Yes
include pre.mak
PackageName := lp_solve
PackageExtension := tar.gz
PackageSeparator := _
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
LpSolveBuildScriptName := ccc$(LPSolveMakefileExtension)
LpSolveAppDir := lp_solve
LpSolveLibDir := lpsolve55
LpSolveAppBuildDir := $(call GenerateBuildPaths,$(LpSolveAppDir))
LpSolveLibBuildDir := $(call GenerateBuildPaths,$(LpSolveLibDir))
LpSolveBuildAppScript := $(call Slashify,$(LpSolveAppBuildDir))$(LpSolveBuildScriptName)
LpSolveBuildLibScript := $(call Slashify,$(LpSolveLibBuildDir))$(LpSolveBuildScriptName)
LpSolveAppName := lp_solve$(ProgramSuffix)
LpSolveArchiveLibName := liblpsolve55$(ArchiveLibrarySuffix)
LpSolveSharedLibName := liblpsolve55$(SharedLibrarySuffix)
LpSolveBinaryDir := bin
LpSolveAppBuildPath := $(call Slashify,$(LpSolveAppBuildDir))$(LpSolveBinaryDir)/$(LpSolveAppName)
LpSolveArchiveLibBuildPath := $(call Slashify,$(LpSolveLibBuildDir))$(LpSolveBinaryDir)/$(LpSolveArchiveLibName)
LpSolveSharedLibBuildPath := $(call Slashify,$(LpSolveLibBuildDir))$(LpSolveBinaryDir)/$(LpSolveSharedLibName)
LpSolveAppResultDir := $(call GenerateResultPaths,,bin)
LpSolveAppResultPath := $(call Slashify,$(LpSolveAppResultDir))$(LpSolveAppName)
LpSolveLibResultDir := $(call GenerateResultPaths,,lib)
LpSolveArchiveLibResultPath := $(call Slashify,$(LpSolveLibResultDir))$(LpSolveArchiveLibName)
LpSolveSharedLibResultPath := $(call Slashify,$(LpSolveLibResultDir))$(LpSolveSharedLibName)
LpSolveIncResultDir := $(call GenerateResultPaths,,include)
LpSolveIncNames := lp_lib.h lp_types.h lp_utils.h lp_fortify.h fortify.h declare.h \
lp_bit.h lp_crash.h lp_explicit.h lp_Hash.h lpkit.h lp_matrix.h \
lp_MDO.h lp_mipbb.h lp_MPS.h lp_presolve.h lp_price.h lp_pricePSE.h lp_report.h \
lp_rlp.h lp_scale.h lp_simplex.h lp_SOS.h lp_wlp.h ufortify.h yacc_read.h
LpSolveIncSourcePaths := $(addprefix $(call Slashify,$(PackageSourceDir)),$(LpSolveIncNames))
LpSolveIncResultPaths := $(addprefix $(call Slashify,$(LpSolveIncResultDir)),$(LpSolveIncNames))
LpSolveBuildWatchPath := $(call GenerateBuildPaths,lp_lib.h)
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/README.txt: source
$(PackageLicenseFile): $(PackageSourceDir)/README.txt
$(copy-result)
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
$(expand-and-patch-package)
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Generate the package shadow directory. We set up the dependencies in this arbitrary way to ensure that 'create-links' runs once and only once.
$(LpSolveBuildWatchPath): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
$(LpSolveBuildAppScript) $(LpSolveBuildLibScript): $(LpSolveBuildWatchPath)
# Configure the source for building.
.PHONY: configure
configure: source
# Build the source into the package application and libraries.
$(LpSolveArchiveLibBuildPath) $(LpSolveSharedLibBuildPath): $(LpSolveBuildLibScript)
$(Verbose)cd $(<D) && \
ar=$(AR) c="$(CC) $(CPPOPTFLAGS)" ranlib=$(RANLIB) libtool=$(LIBTOOL) \
sh -x ./$(<F)
$(LpSolveAppBuildPath): $(LpSolveBuildAppScript)
$(Verbose)cd $(<D) && \
c="$(CC) $(CPPOPTFLAGS)" \
sh -x ./$(<F)
.PHONY: build-lib build-app
build-lib: $(LpSolveArchiveLibBuildPath) $(LpSolveSharedLibBuildPath)
build-app: $(LpSolveAppBuildPath)
.PHONY: build
build: build-app build-lib
# Stage the build to a temporary installation area.
$(LpSolveAppResultDir) $(LpSolveLibResultDir) $(LpSolveIncResultDir): | $(ResultDirectory)
$(create-directory)
$(LpSolveArchiveLibResultPath): $(LpSolveArchiveLibBuildPath) | $(LpSolveLibResultDir)
$(copy-result)
$(LpSolveSharedLibResultPath): $(LpSolveSharedLibBuildPath) | $(LpSolveLibResultDir)
$(copy-result)
$(LpSolveAppResultPath): $(LpSolveAppBuildPath) | $(LpSolveAppResultDir)
$(copy-result)
$(LpSolveIncResultPaths): $(LpSolveIncResultDir)/%: $(PackageSourceDir)/% | $(LpSolveIncResultDir)
$(copy-result)
.PHONY: stage-lib stage-app stage-inc
stage-lib: $(LpSolveArchiveLibResultPath) $(LpSolveSharedLibResultPath)
stage-app: $(LpSolveAppResultPath)
stage-inc: $(LpSolveIncResultPaths)
.PHONY: stage
stage: stage-app stage-lib stage-inc
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak