[Bio] / RecoElemSBW / Makefile Repository:
ViewVC logotype

View of /RecoElemSBW/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (download) (annotate)
Mon Sep 22 20:12:04 2003 UTC (16 years, 1 month ago) by efrank
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
dumptoSbml
	give it a RecoId and it dumps SBML

SbmlFactory:
	put in int() for stoich conversions.  may not be right.

SbwFactory:
  	support writing SBML.
	put in int() for stoich conversions.  may not be right

####
#
# NB:  One package, one library.  Period
#
####


PACKAGE := RecoElemSBW

###########
# Sources #
###########

# BINS have main()s in them.  They don't go into libs.  They are 1-1 with
# linked executables and agree in name, i.e., Foo.cc makes exe, "Foo".
# CCBINS vs. PCCBINS separates out normal mains from ones that need Pro/C
# because they have different build rules.

CCBINS       := RecoElemSBWServer RecoElemSBWSampleClient SBMLtoRecoElem dumpToSbml
PCCBINS      :=

# BINSCRIPTS are scripts to copy to the bin directory

BINSCRIPTS   := 

# The next two can be automated and will be soon but are here for now

LDFLAGS = -L$(libdir) -L$(ORACLE_HOME)/lib -L$(SBWBASE)/lib -L$(SBMLBASE)/lib\
	-Xlinker -rpath -Xlinker $(SBWBASE)/lib \
	-L$(XERCESBASE)/lib

LIBS = -lMExplorer -lRecoElemSBW -lRecoReadoutOracle -lRecoReadout -lclntsh -lsqlplus -lsbw \
	-lsbml -lxerces-c -lpthread 


########################################################################
#
# Everything that follows ought to be package independent and will be
# included as standard.mk once I figure out what package to put that in.
#
#



BINS         := $(CCBINS) $(PCCBINS)
CCBINFILES  := $(addsuffix .cc, $(CCBINS))
PCCBINFILES := $(addsuffix .pcc, $(CCBINS))


##  The rest you shouldn't need to touch, execpt the dependencies at the
# bottom, until auto dependency is turned on.

# These are sources that do go into libs.  You shouldn't need to edit this.

LIBPCCFILES = $(filter-out $(PCCBINFILES), $(wildcard *.pcc) )
LIBCCFILES  = $(filter-out $(CCBINFILES), $(wildcard *.cc) )
OBJS  = $(subst .cc,.o, $(LIBPCCFILES) $(LIBCCFILES))


############################
# "Global-ish"  parameters #
############################

# someday, will specify the architecture as a subdir of buildir, bindir
# and libdir.

srcdir  := $(PWD)/
reldir  := $(PWD)/../
buildir := $(reldir)tmp/
bindir  := $(reldir)bin/
libdir  := $(reldir)lib/

# the library for this package.

LIB := $(libdir)lib$(PACKAGE).a

# Oracle ProC/C++ precompiler
PROC = proc

# SBW stuff

SBWBASE = /nfs/proj-sysbio/SysBio/external/releases/0.0.0
SBMLBASE= /nfs/proj-sysbio/SysBio/external/releases/0.0.0
XERCESBASE= /nfs/proj-sysbio/SysBio/external/releases/0.0.0


SBWINC  = $(SBWBASE)/include
SBMLINC = $(SBMLBASE)/include
XERCESINC = $(XERCESBASE)/include

INCLUDES :=  -I$(reldir) -I$(SBWINC) -I$(SBMLINC) -I$(XERCESINC)

CXX        := g++
CXXFLAGS   := -g -DLINUX
CXXAR	   := ar     #on some sys, c++ compiler must build .a's
CXX_SUFFIX :=.cc

AR	   := ar
MFLAG      := -M

CC = gcc
CFLAGS = -g -DLINUX

#LDFLAGS = -L$(libdir) -L$(ORACLE_HOME)/lib
#LIBS =  -lBio -lclntsh -lsqlplus

###########
# Targets #
###########

# for scalability reasons, someday there will be no all and no
# auto chase through all dependencies...long story.

all: lib bin

lib: $(LIB)

bin: $(addprefix $(bindir),$(BINS) $(BINSCRIPTS))

clean:
	rm -f $(buildir)* $(addprefix $(bindir), $(BINS) $(BINSCRIPTS)) $(LIB)


# we make the lib depend on its .o's then use auto generated dependency
# rules to tie the .o's to source files.  that will snag a .cc.o or other
# dot rule.  The dot rule will compile and insert into the lib.

$(LIB) : $(foreach V, $(LIBCCFILES),$(LIB)($(V:$(CXX_SUFFIX)=.o))) \
	$(foreach V, $(LIBPCCFILES),$(LIB)($(V:.pcc=.o)))



# Tie the BINS to their source files and give a rule for making them. This is
# possible because of the naming scheme.  Notice that we are keeping the .o
# for the file with main() out of the lib.

$(addprefix $(bindir),$(CCBINS)): $(bindir)% : $(srcdir)%.cc
	cd $(buildir); $(CXX) $(CXXFLAGS) -o $(bindir)$* $? $(INCLUDES) $(LDFLAGS)  $(LIBS)

$(addprefix $(bindir),$(PCCBINS)): $(bindir)% : $(srcdir)%.pcc
	cd $(buildir); $(CXX) $(CXXFLAGS) -o $(bindir)$* $? $(INCLUDES) $(LDFLAGS)  $(LIBS)

# Copy the scripts to bin.  Someday this may have to localize the script.

$(addprefix $(bindir),$(BINSCRIPTS)): $(bindir)% : $(srcdir)%
	cp -p $< $@


############################
# pattern and suffix rules #
############################


.SUFFIXES: .cc .o .pcc .pc .c


# basic rule to get bar.cc into libFoo(bar.o). We do the ar here because
# c++ ar is different from c ar on some systems and by the time we have a
# .o, we don't know what lang it came from. Notice this is in terms of
# $(srcdir)%.cc! (see .pcc below)

(%.o) : $(srcdir)%.cc
	cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
	$(CXXAR) cr $@ $(buildir)$*.o


# ...and for bar.c

(%.o) : $(buildir)%.c
	cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)$<
	$(AR) cr $@ $(buildir)$*.o

# rules for Oracle Pro/C++ file.  The Pro/C file ends in .pcc and is in the
# sourcedir.  The generated file, from Pro/C, will be erased and is put in
# the build directory.  That is why, unlike the normal .cc pattern, this
# keys off the buildir.  We separate pcc->cc from cc->o so that the pcc->cc
# step can be reused for pcc->.d (dependency from pcc file).

$(buildir)%.cc : $(srcdir)%.pcc
	cd $(buildir); $(PROC) code=cpp cpp_suffix=cc include=$(reldir) oname=$(buildir)$*.cc $<

(%.o) : $(buildir)%.cc
	cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
	$(CXXAR) cr $@ $(buildir)$*.o

# and now for Pro/C rather than Pro/C++

$(buildir)%.c : $(srcdir)%.pc
	cd $(buildir); $(PROC) code=c include=$(reldir) oname=$(buildir)$*.c $<


# We probably don't want these....
#.cc.o:
#	cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $(srcdir)$<
#
#.c.o:
#	cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)$<
#

################
# Dependencies #
################


$(addsuffix .d, $(addprefix $(buildir),$(LIBCCFILES:.cc=) $(CCBINS))): $(buildir)%.d : $(srcdir)%.cc
	@echo "Making $(@F)"; \
	sh -ec '$(CXX) $(MFLAG) $(CXXFLAGS) $(INCLUDES) $< | sed '\''s?$*\.o?$(LIB)\($*.o\) $@ ?g'\''  > $@'


$(addsuffix .d, $(addprefix $(buildir),$(LIBPCCFILES:.pcc=) $(PCCBINS))): $(buildir)%.d : $(buildir)%.cc
	@echo "Making $(@F)"; \
	sh -ec '$(CXX) $(MFLAG) $(CXXFLAGS) $(INCLUDES) $< | sed '\''s?$*\.o?$(LIB)\($*.o\) $@ ?g'\''  > $@'


-include $(addsuffix .d, $(addprefix $(buildir),$(CCBINS) $(LIBCCFILES:.cc=) $(LIBPCCFILES:.pcc=) $(LIBPCCFILES:.pcc=)))

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3