[0b990d] | 1 | TOPDIR=../../..
|
---|
| 2 | ifndef SRCDIR
|
---|
| 3 | BUILDING_IN_SRCDIR=yes
|
---|
| 4 | SRCDIR=$(shell pwd)
|
---|
| 5 | endif
|
---|
[482400e] | 6 | BUILDDIR=$(shell pwd)
|
---|
[0b990d] | 7 |
|
---|
| 8 | LOCALMAKEFILE_OPTIONAL = yes
|
---|
| 9 | include $(SRCDIR)/$(TOPDIR)/lib/GlobalMakefile
|
---|
| 10 |
|
---|
| 11 | ifeq ($(LOCALMAKEFILE_FOUND),yes)
|
---|
| 12 |
|
---|
| 13 | include $(TOPDIR)/lib/Makedirlist
|
---|
| 14 | INCLUDE += -I. -I$(SRCDIR)
|
---|
| 15 | CXXINCLUDE += -I. -I$(SRCDIR)
|
---|
| 16 |
|
---|
| 17 | TARGET_TO_MAKE = mpqc
|
---|
| 18 |
|
---|
| 19 | CXXSRC = mpqc.cc mpqcin.cc
|
---|
| 20 | GENCXXSRC = parse.cc scan.cc
|
---|
| 21 | CSRC =
|
---|
| 22 | INC =
|
---|
| 23 | GENINC = parse.h
|
---|
| 24 |
|
---|
| 25 | DEPENDINCLUDE = $(INC)
|
---|
| 26 |
|
---|
| 27 | BINOBJ = $(CXXSRC:%.cc=%.$(OBJSUF)) $(GENCXXSRC:%.cc=%.$(OBJSUF)) $(CSRC:%.c=%.$(OBJSUF))
|
---|
| 28 |
|
---|
| 29 | DISTFILES = $(CXXSRC) $(CSRC) $(INC) Makefile LIBS.h
|
---|
| 30 |
|
---|
| 31 | default:: mpqc
|
---|
| 32 |
|
---|
| 33 | DEFINES += \
|
---|
[482400e] | 34 | -DHAVE_JOBMARKET -I$(SRCDIR)/$(TOPDIR)/../JobMarket/src -I$(TOPDIR)/../JobMarket -I$(SRCDIR)/$(TOPDIR)/../../src -I$(SRCDIR)/$(TOPDIR)/../LinearAlgebra/src $(BOOST_SYSTEM_CFLAGS)\
|
---|
| 35 | -DHAVE_MPQCDATA -I$(TOPDIR)/../../src
|
---|
[0b990d] | 36 |
|
---|
| 37 | XDEF =
|
---|
[482400e] | 38 | XLIBS = -L$(TOPDIR)/../JobMarket/src/JobMarket/.libs -Wl,-rpath,$(BUILDDIR)/$(TOPDIR)/../JobMarket/src/JobMarket/.libs -lJobMarketPoolWorker -lJobMarket -L$(TOPDIR)/../../src/.libs -Wl,-rpath,$(BUILDDIR)/$(TOPDIR)/../../src/.libs -lMolecuilderJobs -lMolecuilderFragmentationSummation $(BOOST_SYSTEM_LDFLAGS) -lboost_serialization
|
---|
[0b990d] | 39 | ifeq ($(HAVE_SC_SRC_LIB_CHEMISTRY_QC_PSI),yes)
|
---|
| 40 | XDEF += -DHAVE_CHEMISTRY_QC_PSI
|
---|
| 41 | endif
|
---|
| 42 | ifeq ($(HAVE_SC_SRC_LIB_CHEMISTRY_QC_CC),yes)
|
---|
| 43 | XDEF += -DHAVE_CHEMISTRY_QC_CC
|
---|
| 44 | endif
|
---|
| 45 | ifeq ($(HAVE_SC_SRC_LIB_CHEMISTRY_QC_CINTS),yes)
|
---|
| 46 | ifeq ($(HAVE_SC_SRC_LIB_CHEMISTRY_QC_MBPTR12),yes)
|
---|
| 47 | XDEF += -DHAVE_CHEMISTRY_QC_MBPTR12
|
---|
| 48 | endif
|
---|
| 49 | XDEF += -DHAVE_CHEMISTRY_QC_CINTS
|
---|
| 50 | endif
|
---|
| 51 |
|
---|
| 52 | ifeq ($(HAVE_LIBINT),yes)
|
---|
| 53 | XLIBS += -lint
|
---|
| 54 | endif
|
---|
| 55 | ifeq ($(HAVE_LIBR12),yes)
|
---|
| 56 | XLIBS += -lr12
|
---|
| 57 | endif
|
---|
| 58 | ifeq ($(HAVE_LIBDERIV),yes)
|
---|
| 59 | XLIBS += -lderiv
|
---|
| 60 | endif
|
---|
| 61 | ifeq ($(HAVE_SC_SRC_LIB_CHEMISTRY_CCA),yes)
|
---|
| 62 | ifeq ($(ENABLESHARED),yes)
|
---|
| 63 | LTLINKBINOPTS += -R$(CCAFE_LIB) -R$(CCA_CHEM_LIB)
|
---|
| 64 | else
|
---|
| 65 | XLIBS += -L$(CCA_CHEM_LIB) -L$(CCAFE_LIB) -L$(CCA_SPEC_BABEL_LIB) -L$(BABEL_LIB) \
|
---|
| 66 | -lccachem_cxx_server -lccachem_cxx_client -lccafeCore -lcca -lsidl -lxml2 -lz
|
---|
| 67 | endif
|
---|
| 68 | DEFINES += -DHAVE_CHEMISTRY_CCA -DCCA_PATH=\"$(libdir)/cca\"
|
---|
| 69 | CPPFLAGS += -I../../lib/chemistry/cca
|
---|
| 70 | endif
|
---|
| 71 |
|
---|
| 72 | LIBS := $(shell $(LISTLIBS) $(INCLUDE) $(DEFINES) $(XDEF) $(SRCDIR)/LIBS.h)
|
---|
| 73 |
|
---|
| 74 | #################################################################
|
---|
| 75 |
|
---|
| 76 | default:: $(DEPENDINCLUDE)
|
---|
| 77 |
|
---|
| 78 | include $(SRCDIR)/$(TOPDIR)/lib/GlobalRules
|
---|
| 79 |
|
---|
| 80 | mpqc: $(BINOBJ) $(LIBS)
|
---|
| 81 | echo "$(LISTLIBS) $(INCLUDE) $(DEFINES) $(XDEF) $(SRCDIR)/LIBS.h"
|
---|
| 82 | $(LTLINK) $(LD) $(LDFLAGS) -o $@ $^ $(XLIBS) $(SYSLIBS) $(LTLINKBINOPTS)
|
---|
| 83 |
|
---|
| 84 | $(TOPDIR)/lib/libmpqc.a: $(BINOBJ)
|
---|
| 85 | /bin/rm -f $@
|
---|
| 86 | $(AR) $(ARFLAGS) $@ $^
|
---|
| 87 | $(RANLIB) $@
|
---|
| 88 |
|
---|
| 89 | $(TOPDIR)/lib/libmpqc.la: $(BINOBJ)
|
---|
| 90 | $(LTLINK) $(CXX) -o $@ $^ $(LTLINKLIBOPTS)
|
---|
| 91 |
|
---|
| 92 | install_devel:: $(TOPDIR)/lib/libmpqc.$(LIBSUF)
|
---|
| 93 | $(INSTALL) $(INSTALLDIROPT) $(installroot)$(libdir)
|
---|
| 94 | $(LTINST) $(INSTALL) $(INSTALLLIBOPT) $< $(installroot)$(libdir)
|
---|
| 95 |
|
---|
| 96 | install:: mpqc
|
---|
| 97 | $(INSTALL) $(INSTALLDIROPT) $(installroot)$(bindir)
|
---|
| 98 | $(LTINST) $(INSTALL) $(INSTALLBINOPT) $< $(installroot)$(bindir)
|
---|
| 99 | $(INSTALL) $(INSTALLSCRIPTOPT) mpqcrun $(installroot)$(bindir)/mpqcrun
|
---|
| 100 | $(INSTALL) $(INSTALLSCRIPTOPT) ccarun $(installroot)$(bindir)/ccarun
|
---|
| 101 | $(INSTALL) $(INSTALLDIROPT) $(installroot)$(scdatadir)
|
---|
| 102 | $(INSTALL) $(INSTALLSCRIPTOPT) $(SRCDIR)/mpqcrunproc $(installroot)$(scdatadir)/mpqcrunproc
|
---|
| 103 | $(INSTALL) $(INSTALLSCRIPTOPT) $(SRCDIR)/ccarunproc $(installroot)$(scdatadir)/ccarunproc
|
---|
| 104 |
|
---|
| 105 | install::
|
---|
| 106 | /bin/rm -f $(installroot)$(bindir)/chkmpqcout
|
---|
| 107 | sed "s+exec perl+exec perl -I$(scdatadir)/perl+" \
|
---|
| 108 | < $(SRCDIR)/validate/checkout.pl \
|
---|
| 109 | > $(installroot)$(bindir)/chkmpqcout
|
---|
| 110 | chmod 555 $(installroot)$(bindir)/chkmpqcout
|
---|
| 111 |
|
---|
| 112 | clean::
|
---|
| 113 | /bin/rm -f mpqc
|
---|
| 114 | /bin/rm -f parse.tmp*
|
---|
| 115 |
|
---|
| 116 | distclean::
|
---|
| 117 | /bin/rm -f mpqc
|
---|
| 118 | /bin/rm -f parse.tmp*
|
---|
| 119 | /bin/rm -f $(GENCXXSRC) $(GENINC) parse.output
|
---|
| 120 | /bin/rm -f mpqcrun
|
---|
| 121 |
|
---|
| 122 | ifneq ($(BUILDING_IN_SRCDIR),yes)
|
---|
| 123 | ifeq ($(wildcard parse.cc),parse.cc)
|
---|
| 124 | $(error "parse.cc exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
| 125 | endif
|
---|
| 126 | ifeq ($(wildcard scan.cc),scan.cc)
|
---|
| 127 | $(error "scan.cc exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
| 128 | endif
|
---|
| 129 | ifeq ($(wildcard parse.h),parse.h)
|
---|
| 130 | $(error "parse.h exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
| 131 | endif
|
---|
| 132 | endif
|
---|
| 133 |
|
---|
| 134 | $(SRCDIR)/parse.cc: $(SRCDIR)/parse.yy
|
---|
| 135 | @echo WARNING: The file $@ is out of date.
|
---|
| 136 | @echo It can be built by running \"make parser DODEPEND=no\" in the source directory.
|
---|
| 137 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
| 138 |
|
---|
| 139 | $(SRCDIR)/parse.h: $(SRCDIR)/parse.yy
|
---|
| 140 | @echo WARNING: The file $@ is out of date.
|
---|
| 141 | @echo It can be built by running \"make parser DODEPEND=no\" in the source directory.
|
---|
| 142 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
| 143 |
|
---|
| 144 | $(SRCDIR)/scan.cc: $(SRCDIR)/scan.ll
|
---|
| 145 | @echo WARNING: The file $@ is out of date.
|
---|
| 146 | @echo It can be built by running \"make scanner DODEPEND=no\" in the source directory.
|
---|
| 147 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
| 148 |
|
---|
| 149 | #################################################################
|
---|
| 150 |
|
---|
| 151 | $(BINOBJ:.$(OBJSUF)=.d): $(DEPENDINCLUDE)
|
---|
| 152 | ifneq ($(DODEPEND),no)
|
---|
| 153 | include $(BINOBJ:.$(OBJSUF)=.d)
|
---|
| 154 | endif
|
---|
| 155 |
|
---|
| 156 | endif
|
---|
| 157 |
|
---|
| 158 | ifndef FLEX
|
---|
| 159 | FLEX=flex
|
---|
| 160 | endif
|
---|
| 161 |
|
---|
| 162 | ifndef BISON
|
---|
| 163 | BISON=bison
|
---|
| 164 | endif
|
---|
| 165 |
|
---|
| 166 | notobjdir_default:
|
---|
| 167 | @echo "Building in an unconfigured source directory."
|
---|
| 168 | @echo "The following make targets are available:"
|
---|
| 169 | @echo " make FLEX=<flex> scanner"
|
---|
| 170 | @echo " make BISON=<bison> parser"
|
---|
| 171 | @echo "Be sure to replace FlexLexer.h in the include"
|
---|
| 172 | @echo "directory with the correct version."
|
---|
| 173 |
|
---|
| 174 | # (only works with bison and flex)
|
---|
| 175 | .PHONY: parser
|
---|
| 176 | parser:
|
---|
| 177 | $(BISON) -v -d -o parse.tmp.cc parse.yy
|
---|
| 178 | cat parse.tmp.cc \
|
---|
| 179 | | sed "s/^int yyparse.*;$$//" \
|
---|
| 180 | | sed "s/^YYPARSE_RETURN_TYPE yyparse.*;$$//" \
|
---|
| 181 | | sed "s/yylval/MPQCInylval/g" \
|
---|
| 182 | > parse.cc
|
---|
| 183 | if test -f parse.tmp.cc.h; then \
|
---|
| 184 | echo "Older bison detected."; \
|
---|
| 185 | cat parse.tmp.cc.h | sed "s/yylval/MPQCInylval/g" > parse.h; \
|
---|
| 186 | /bin/mv parse.tmp.cc.output parse.output; \
|
---|
| 187 | else \
|
---|
| 188 | echo "Newer bison detected."; \
|
---|
| 189 | cat parse.tmp.hh | sed "s/yylval/MPQCInylval/g" > parse.h; \
|
---|
| 190 | /bin/mv parse.tmp.output parse.output; \
|
---|
| 191 | fi
|
---|
| 192 | #-@rm -f parse.tmp*
|
---|
| 193 |
|
---|
| 194 | .PHONY: scanner
|
---|
| 195 | scanner:
|
---|
| 196 | echo "#ifdef HAVE_CONFIG_H" > scan.cc
|
---|
| 197 | echo "#include <scconfig.h>" >> scan.cc
|
---|
| 198 | echo "#endif" >> scan.cc
|
---|
| 199 | echo "#include <iostream>" >> scan.cc
|
---|
| 200 | echo "#ifdef USING_NAMESPACE_STD" >> scan.cc
|
---|
| 201 | echo "using namespace std;" >> scan.cc
|
---|
| 202 | echo "#endif" >> scan.cc
|
---|
| 203 | $(FLEX) -L -t scan.ll | grep -v "extern FILE .yyin" \
|
---|
| 204 | | grep -v "static int yy_get_next_buffer.*;" \
|
---|
| 205 | | grep -v "class istream;" \
|
---|
| 206 | | sed "s/static int yy_get_next_buffer/int yy_get_next_buffer/" \
|
---|
| 207 | | grep -v "static void yyunput.*;" \
|
---|
| 208 | | sed "s/static void yyunput/void yyunput/" \
|
---|
| 209 | | grep -v "static int yyinput.*;" \
|
---|
| 210 | | grep -v "extern.*isatty" \
|
---|
| 211 | | sed "s/static int yyinput/int yyinput/" \
|
---|
| 212 | | sed "s/yylval/MPQCInylval/g" \
|
---|
| 213 | >> scan.cc
|
---|