source: src/bin/mpqc/Makefile@ 9b827f

Last change on this file since 9b827f was 5d30c1, checked in by Frederik Heber <heber@…>, 13 years ago

Initial commit based on 3.0.0alpha (here claimed as 2.4).

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