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