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

View of /ReleaseTools/Makefile.top

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (download) (annotate)
Fri Nov 19 18:10:34 2004 UTC (15 years, 3 months ago) by efrank
Branch: MAIN
CVS Tags: gunk, V00-00-15, stMigration0, post-st-migration2, post-st-migration
Changes since 1.14: +14 -3 lines
changes affecting SchemaTools

########################################################################
# 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


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)

	


# 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 $(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

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

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



########################################################################
# Rules
#
# These rules convert PACKAGENAME.rule into make operations 
# in PACKAGENAME
########################################################################

%.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


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3