[Bio] / ReleaseTools / Makefile.top Repository:
ViewVC logotype

View of /ReleaseTools/Makefile.top

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (download) (annotate)
Thu May 19 20:50:55 2005 UTC (14 years, 6 months ago) by efrank
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2008_06_18, rast_rel_2008_06_16, mgrast_dev_04082011, Root-bobdev_news, merge-trunktag-bobdev_news-2, merge-trunktag-bobdev_news-1, rast_rel_2009_05_18, rast_rel_2009_0925, rast_rel_2010_0118, preTreatmanDyn, merge-trunktag-bodev_news-3, rast_rel_2009_02_05, rast_rel_2011_0119, rast_rel_2008_12_18, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2011_0928, mgrast_rel_2008_0917, mgrast_dev_04052011, merge-bodev_news-3, mobedac_release_05302012, rast_rel_2010_0928, mgrast_version_3_2, caBIG-05Apr06-00, mgrast_dev_02212011, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, merge-bobdev_news-2, merge-bobdev_news-1, mgrast_dev_05262011, mgrast_rel_2008_0806, rast_rel_2008_08_07, myrast_33, rast_rel_2008_09_29, mgrast_dev_02222011, mgrast_dev_10262011, rast_rel_2008_11_24, mgrast_dev_06072011, rast_rel_2008_09_30, before-dynamics-persistence, rast_rel_2008_10_29, rast_rel_2014_0729, mgrast_dev_03252011, mgrast_release_3_0, rast_rel_2010_1206, mgrast_rel_2008_0924, lwc, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, makeScriptHeaders, rast_rel_2008_07_21, mgrast_rel_2008_0923, mgrast_release_3_0_1, rast_rel_2010_0827, rast_rel_2009_03_26, rast_2008_0924, mgrast_dev_12152011, rast_rel_2010_0526, rast_rel_2008_04_23, caBIG-00-00-00, mgrast_rel_2008_1110_v2, mgrast_dev_04012011, treatman-lastDay-0, mgrast_rel_2008_1110, caBIG-13Feb06-00, HEAD
Branch point for: Branch-bobdev_news
Changes since 1.18: +3 -3 lines

fix typo/ brain fade

########################################################################
# Top level makefile for ReleaseTools.  Will be copied into work 
# directory as Makefile.  Our job here is to define basic environment
# and then iterate over the checked outpackages in the work directory,
# invoking make methods there.  This is one level!  Not recursive.
#
# Ed Frank, Argonne National Laboratory
#   Based upon work of Bob Jacobsen, Lawrence Berkeley National Lab
########################################################################


########################################################################
# The basic environment, macros etc. Our only external environment
# variables are:
#    RTDIST
#    RTARCH
#    RTCURRENT
########################################################################


SHELL = /bin/sh

# these two used to be "if ndef".  why?

export PWD := $(shell pwd)
export TOPDIR := $(shell /bin/pwd)

# expect includes of the form #include "PackageName/item.h"
CPPFLAGS += -I$(PWD)
LDFLAGS += -L$(PWD)/$(RTARCH)/lib
MAKEINCLUDE := -I$(PWD)/ReleaseTools

# this isn't right...should look at rtDist to figure out
# where THIS workdir came from

ifdef RTCURRENT
CPPFLAGS += -I$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/include
LDFLAGS += -L$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/lib
MAKEINCLUDE += -I$(RTDIST)/releases/$(RTCURRENT)/ReleaseTools
endif

libdir    = $(PWD)/$(RTARCH)/lib
bindir    = $(PWD)/$(RTARCH)/bin
cgidir    = $(PWD)/$(RTARCH)/CGI
workdir   =$(PWD)/$(RTARCH)/tmp
tutdir    = $(PWD)/$(RTARCH)/Tutorial

TOOL_HDR := $(TOPDIR)/$(RTARCH)/tool_hdr
TOOL_HDR_PY := $(TOPDIR)/$(RTARCH)/tool_hdr_py

PACKAGES := $(subst /,, $(dir $(wildcard */Makefile)))

#
# OVERRIDES is a macro passed into children-makes to guide them.
#

OVERRIDES = \
	$(MAKEINCLUDE) \
	TOPDIR=$(TOPDIR) \
	TOOL_HDR=$(PWD)/$(RTARCH)/tool_hdr \
	TOOL_HDR_PY=$(PWD)/$(RTARCH)/tool_hdr_py \
	libdir=$(libdir) \
	bindir=$(bindir) \
	cgidir=$(cgidir) \
	PKGNAME=$(basename $@) \
	CPPFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS)" \
	workdir=$(workdir)/$(basename $@) \
	tutdir=$(tutdir)

########################################################################
#
# Targets- these are actually done by the packages, except for
#          a few setup-like things, eg., installdirs.
#
# Note that the behavior of package makefiles is centralized
# into ReleaseTools/standard.mk.  The package makefiles only
# define a few macros to define their needs, whenever possible.
#
########################################################################

.PHONY: lib bin schematools stDeclFiles stGeneratedFiles clean test purge check_env

# if you change all: make sure all: in standard.mk is consistent.

all: Makefile installdirs decouple schematools lib bin

schematools: stDeclFiles stGeneratedFiles

# The rule is that all the lib targets from the various packages can
# be built in any order.  After that, all teh bins can go, again in
# any order.  But there are a *very few* things that need to be built
# first and perhaps in order.  The decouple: target handles those.
# The $(wildcard foo) trick returns an empty list of foo is not
# present, e.g., the package is not checked out.  This lets the
# decouple target be declared without forcing people to check out
# those packages, i.e., they can just run off the versions in the
# base release.  Thus, decouple is for from-scratch release builds
# and for development of these few, special core packages.

decouple: $(wildcard ReleaseTools) $(wildcard KahDataServices) $(TOOL_HDR) $(TOOL_HDR_PY)

	


# Use the PACKAGES macro to transform lib, bin, etc., targets
# into package level dependencies, e.g., lib -> PkgA.lib, PkgB.lib
# Rules below then cause PkgA.lib to do a make in PkgaA on lib:

ALL.LIB = check_env $(foreach var,$(PACKAGES),$(var).lib)
lib:  Makefile $(ALL.LIB)

ALL.BIN = check_env $(foreach var,$(PACKAGES),$(var).bin)
bin: Makefile $(ALL.BIN)

ALL.STDECLFILES = check_env $(foreach var,$(PACKAGES),$(var).stDeclFiles)
stDeclFiles: Makefile $(ALL.STDECLFILES)

ALL.STGENERATEDFILES = check_env $(foreach var,$(PACKAGES),$(var).stGeneratedFiles)
stGeneratedFiles: Makefile $(ALL.STGENERATEDFILES)

ALL.TEST = check_env $(foreach var,$(PACKAGES),$(var).test)
test: Makefile $(ALL.TEST)

ALL.CLEAN = check_env $(foreach var,$(PACKAGES),$(var).clean)
#clean: $(ALL.CLEAN)

clean: Makefile check_env purge installdirs

purge: check_env
	rm -rf $(RTARCH)/bin $(RTARCH)/lib $(RTARCH)/tmp $(RTARCH)/CGI

# Make sure the top-level makefile is up to date
#    the wildcard below only returns something if ReleaseTools is checked out.
#    Otherwise, if ReleaseTools was not checked out, make would complain and
#    quit about "no such file"

Makefile: $(wildcard ReleaseTools/Makefile.top)
	echo $(wildcard ReleaseTools/Makefile.top)
	cp ReleaseTools/Makefile.top Makefile
	@echo ""
	@echo "A new makefile was installed; please rerun your make command."
	@echo ""
	@exit 1

check_env: 
ifndef RTARCH
	@echo ""
	@echo "FIG build environment is not properly configured."
	@echo "Did you source fig-user-env ?"
	@echo ""
	@exit 1
endif

##
# Targets to setup the expected directory structure for the
# work directory.  The work directory should be created
# with the mkworkdir command.
###

# If make installdirs is called when no packages are checked out,
# then lib and tmp are not made.  So we add two rules here
# to handle that case.

installdirs: check_env $(libdir) $(bindir) $(cgidir) $(cgidir)/Html $(cgidir)/Html/css $(workdir) $(tutdir)
	- mkdir -p $(tutdir) $(tutdir)/python $(tutdir)/perl
	- mkdir -p $(libdir)
	- mkdir -p $(workdir)
	- mkdir -p $(bindir)
	- mkdir -p $(cgidir)
	- mkdir -p $(cgidir)/p2p

# the subdirs are for putting python pyc etc. into

$(libdir): $(foreach var,$(PACKAGES),$(libdir)/$(var).installdirs)

$(libdir)/%.installdirs:
	- mkdir -p $(@:.installdirs=)
	- mkdir -p $(@:.installdirs=)Gen
	- touch $(@:.installdirs=)Gen/__init__.py

$(bindir): 
	- mkdir -p $(bindir)

$(cgidir):
	- mkdir $(cgidir)
	- mkdir $(cgidir)/p2p

$(tutdir):
	- mkdir $(tutdir)
	- mkdir $(tutdir)/python
	- mkdir $(tutdir)/perl

$(cgidir)/Html:
	mkdir -p $(cgidir)/Html

$(cgidir)/Html/css:
	mkdir -p $(cgidir)/Html/css

$(workdir): $(foreach var,$(PACKAGES),$(workdir)/$(var).installdirs)

$(workdir)/%.installdirs:
	- mkdir -p $(@:.installdirs=)



########################################################################
# Rules
#
# These rules convert PACKAGENAME.rule into make operations 
# in PACKAGENAME.  Real rules live in standard.mk
########################################################################

%.all:
	@$(MAKE) -C $(@:.lib=) $(OVERRIDES) all

%.lib:
	@$(MAKE) -C $(@:.lib=) $(OVERRIDES) lib

%.bin:
	@$(MAKE) -C $(@:.bin=) $(OVERRIDES) bin

%.schematools:
	@$(MAKE) -C $(@:.schematools=) $(OVERRIDES) schematools

%.stDeclFiles:
	@$(MAKE) -C $(@:.stDeclFiles=) $(OVERRIDES) stDeclFiles

%.stGeneratedFiles:
	@$(MAKE) -C $(@:.stGeneratedFiles=) $(OVERRIDES) stGeneratedFiles

%.test:
	@$(MAKE) -C $(@:.test=) $(OVERRIDES) test

%.clean:
	@$(MAKE) -C $(@:.clean=) $(OVERRIDES) clean

# implementation of the decouple: steps that just build whole packages
# the .PHONY here lets us defer to the lib and bin in the package

.PHONY: KahDataServices
KahDataServices:
	# this one we do by hand and a little out of order...
	# we must get bin done here to have the programs that
	# implement schematools target.
	@$(MAKE) -C $(@:.clean=) $(OVERRIDES) lib
	@$(MAKE) -C $(@:.clean=) $(OVERRIDES) bin
	@$(MAKE) -C $(@:.clean=) $(OVERRIDES) schematools

.PHONY: ReleaseTools
ReleaseTools:
	@$(MAKE) -C $(@:.clean=) $(OVERRIDES) all

##
# generation of the tool_header files.  part of decouple
#   these live in $(TOPDIR)/$(RTARCH) but should live
#   in $(libdir).
#
# We use the wildcard trick again so that we have the dependency
# only if ReleaseTools is checked out.  If not checked out, we
# are by definition satisfied with makeScriptHeaders in the base
# release. Note we must make the dependency be on the source file,
# not the $(bindir) file because if the latter does not exist, the
# wildcard fails and there's no dependency!  But if the ReleaseTools/make*
# exists and is newer, then we just defer to the ReleaseTools target
# used above for decouple:
##


$(TOPDIR)/$(RTARCH)/tool_hdr: $(wildcard ReleaseTools/makeScriptHeaders)
	cd $(TOPDIR); $(bindir)/makeScriptHeaders $(TOPDIR)

$(TOPDIR)/$(RTARCH)/tool_hdr_py: $(wildcard ReleaseTools/makeScriptHeaders)
	cd $(TOPDIR); $(bindir)/makeScriptHeaders $(TOPDIR)

ReleaseTools/makeScriptHeaders: ReleaseTools

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3