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

View of /ReleaseTools/Makefile.top

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (download) (annotate)
Fri May 21 17:55:28 2004 UTC (15 years, 10 months ago) by olson
Branch: MAIN
CVS Tags: V00-00-10, V00-00-12, V00-00-13, V00-00-11, V00-00-14, mass-spec-01, mass-spec-03, mass-spec-02, forRick-14Jul04-0, forRick-14Jul04-1
Changes since 1.11: +26 -10 lines
make the makefile check for proper environment
also add tutorial directory creation

#
# Top level makefile.  Will be copied into work directory as Makefile
#


SHELL = /bin/sh
ifndef PWD
    export PWD := $(shell pwd)
endif

ifndef TOPDIR
    export TOPDIR := $(shell /bin/pwd)
endif

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

ifdef RTCURRENT
CPPFLAGS += -I$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/include
LDFLAGS += -L$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/lib
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)))

.PHONY: lib bin clean test purge check_env

all: Makefile installdirs lib bin

Makefile: 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

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

$(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=)


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


OVERRIDES = \
	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)

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

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

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

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


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3