1 | #
|
---|
2 | # Makefile
|
---|
3 | #
|
---|
4 | # Copyright (C) 1996 Limit Point Systems, Inc.
|
---|
5 | #
|
---|
6 | # Author: Curtis Janssen <cljanss@ca.sandia.gov>
|
---|
7 | # Maintainer: LPS
|
---|
8 | #
|
---|
9 | # This file is part of the SC Toolkit.
|
---|
10 | #
|
---|
11 | # The SC Toolkit is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU Library General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
14 | # any later version.
|
---|
15 | #
|
---|
16 | # The SC Toolkit is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU Library General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU Library General Public License
|
---|
22 | # along with the SC Toolkit; see the file COPYING.LIB. If not, write to
|
---|
23 | # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
24 | #
|
---|
25 | # The U.S. Government is granted a limited license as per AL 91-7.
|
---|
26 | #
|
---|
27 |
|
---|
28 | TOPDIR=../../../..
|
---|
29 | ifndef SRCDIR
|
---|
30 | BUILDING_IN_SRCDIR=yes
|
---|
31 | SRCDIR=$(shell pwd)
|
---|
32 | endif
|
---|
33 |
|
---|
34 | LOCALMAKEFILE_OPTIONAL = yes
|
---|
35 | include $(SRCDIR)/$(TOPDIR)/lib/GlobalMakefile
|
---|
36 |
|
---|
37 | ifeq ($(LOCALMAKEFILE_FOUND),yes)
|
---|
38 |
|
---|
39 | LD = $(CXX)
|
---|
40 |
|
---|
41 | CXXSRC = ipv2.cc ipv2_alloc.cc ipv2_cwk.cc ipv2_data.cc ipv2_error.cc \
|
---|
42 | ipv2_karray.cc ipv2_print.cc ipv2_read.cc \
|
---|
43 | keyval.cc keyvalipv2.cc keyvalval.cc keyvalass.cc \
|
---|
44 | keyvalstr.cc keyvalagg.cc keyvalpre.cc
|
---|
45 |
|
---|
46 | GENCXXSRC =ipv2_parse.cc ipv2_scan.cc
|
---|
47 |
|
---|
48 | TESTPROGS = keyvaltest
|
---|
49 |
|
---|
50 | LIBOBJ = $(CXXSRC:%.cc=%.$(OBJSUF)) $(GENCXXSRC:%.cc=%.$(OBJSUF))
|
---|
51 | GENSRC = $(GENCXXSRC)
|
---|
52 |
|
---|
53 | INC = ipv2.h keyval.h ipv2_scan.h
|
---|
54 | GENINC = ipv2_parse.h
|
---|
55 |
|
---|
56 |
|
---|
57 | DEPENDINCLUDE = $(INC) $(GENINC)
|
---|
58 |
|
---|
59 | BIN_OR_LIB = LIB
|
---|
60 | TARGET_TO_MAKE = libSCkeyval
|
---|
61 |
|
---|
62 | DISTFILES = Makefile $(CXXSRC) $(INC) ipv2_parse.yy ipv2_scan.ll LIBS.h
|
---|
63 |
|
---|
64 | default:: $(DEPENDINCLUDE)
|
---|
65 |
|
---|
66 | keyvaltest: keyvaltest.$(OBJSUF) libSCkeyval.$(LIBSUF) \
|
---|
67 | libSCcontainer.$(LIBSUF) \
|
---|
68 | libSCmisc.$(LIBSUF) libSCgroup.$(LIBSUF) \
|
---|
69 | libSCclass.$(LIBSUF) libSCstate.$(LIBSUF) \
|
---|
70 | libSCref.$(LIBSUF)
|
---|
71 | $(LTLINK) $(LD) $(LDFLAGS) -o keyvaltest $^ $(SYSLIBS) $(LTLINKBINOPTS)
|
---|
72 |
|
---|
73 | keyvaltest.$(OBJSUF): keyvaltest.cc
|
---|
74 | $(LTCOMP) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DSRCDIR=\"$(SRCDIR)\" -c $<
|
---|
75 |
|
---|
76 | include $(SRCDIR)/$(TOPDIR)/lib/GlobalRules
|
---|
77 |
|
---|
78 | distclean::
|
---|
79 | /bin/rm -f keyvaltest ipv2_parse.output
|
---|
80 |
|
---|
81 | $(LIBOBJ:.$(OBJSUF)=.d): $(DEPENDINCLUDE)
|
---|
82 | OTHEROBJ = keyvaltest.$(OBJSUF)
|
---|
83 | ifneq ($(DODEPEND),no)
|
---|
84 | include $(LIBOBJ:.$(OBJSUF)=.d) $(OTHEROBJ:.$(OBJSUF)=.d)
|
---|
85 | endif
|
---|
86 |
|
---|
87 | ifneq ($(BUILDING_IN_SRCDIR),yes)
|
---|
88 | ifeq ($(wildcard ipv2_parse.cc),ipv2_parse.cc)
|
---|
89 | $(error "ipv2_parse.cc exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
90 | endif
|
---|
91 | ifeq ($(wildcard ipv2_scan.cc),ipv2_scan.cc)
|
---|
92 | $(error "ipv2_scan.cc exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
93 | endif
|
---|
94 | ifeq ($(wildcard ipv2_parse.h),ipv2_parse.h)
|
---|
95 | $(error "ipv2_parse.h exists in an object directory. This is now longer necessary or allowed. Delete the file to continue.")
|
---|
96 | endif
|
---|
97 | endif
|
---|
98 |
|
---|
99 | $(SRCDIR)/ipv2_parse.cc: $(SRCDIR)/ipv2_parse.yy
|
---|
100 | @echo WARNING: The file $@ is out of date.
|
---|
101 | @echo It can be built by running \"make parser DODEPEND=no\" in the source directory.
|
---|
102 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
103 |
|
---|
104 | $(SRCDIR)/ipv2_parse.h: $(SRCDIR)/ipv2_parse.yy
|
---|
105 | @echo WARNING: The file $@ is out of date.
|
---|
106 | @echo It can be built by running \"make parser DODEPEND=no\" in the source directory.
|
---|
107 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
108 |
|
---|
109 | $(SRCDIR)/ipv2_scan.cc: $(SRCDIR)/ipv2_scan.ll
|
---|
110 | @echo WARNING: The file $@ is out of date.
|
---|
111 | @echo It can be built by running \"make scanner DODEPEND=no\" in the source directory.
|
---|
112 | @echo You may also get the message on files checked out of CVS, in which case you can touch $@ to stop getting this message.
|
---|
113 |
|
---|
114 | endif
|
---|
115 |
|
---|
116 | ifndef FLEX
|
---|
117 | FLEX=flex
|
---|
118 | endif
|
---|
119 |
|
---|
120 | ifndef BISON
|
---|
121 | BISON=bison
|
---|
122 | endif
|
---|
123 |
|
---|
124 | notobjdir_default:
|
---|
125 | @echo "Building in an unconfigured source directory."
|
---|
126 | @echo "The following make targets are available:"
|
---|
127 | @echo " make FLEX=<flex> scanner"
|
---|
128 | @echo " make BISON=<bison> parser"
|
---|
129 | @echo "Be sure to replace FlexLexer.h in the include"
|
---|
130 | @echo "directory with the correct version."
|
---|
131 |
|
---|
132 | #### yacc and lex ####
|
---|
133 | # (only works with bison and flex)
|
---|
134 | .PHONY: parser
|
---|
135 | parser::
|
---|
136 | $(BISON) -v -d -o ipv2_parse.tmp.cc $^ ipv2_parse.yy
|
---|
137 | sed "s/^int yyparse.*;$$//" < ipv2_parse.tmp.cc \
|
---|
138 | | sed "s/^YYPARSE_RETURN_TYPE yyparse.*;$$//" \
|
---|
139 | | sed "s/__attribute__ ((__unused__))//" \
|
---|
140 | > ipv2_parse.cc
|
---|
141 | if test -f ipv2_parse.tmp.cc.h; then \
|
---|
142 | echo "Older bison detected."; \
|
---|
143 | /bin/mv ipv2_parse.tmp.cc.h ipv2_parse.h; \
|
---|
144 | /bin/mv ipv2_parse.tmp.cc.output ipv2_parse.output; \
|
---|
145 | else \
|
---|
146 | echo "Newer bison detected."; \
|
---|
147 | /bin/mv ipv2_parse.tmp.hh ipv2_parse.h; \
|
---|
148 | /bin/mv ipv2_parse.tmp.output ipv2_parse.output; \
|
---|
149 | fi
|
---|
150 | -@rm -f ipv2_parse.tmp*
|
---|
151 |
|
---|
152 | .PHONY: scanner
|
---|
153 | scanner::
|
---|
154 | echo "#ifdef HAVE_CONFIG_H" > ipv2_scan.cc
|
---|
155 | echo "#include <scconfig.h>" >> ipv2_scan.cc
|
---|
156 | echo "#endif" >> ipv2_scan.cc
|
---|
157 | echo "#include <iostream>" >> ipv2_scan.cc
|
---|
158 | echo "#ifdef USING_NAMESPACE_STD" >> ipv2_scan.cc
|
---|
159 | echo "using namespace std;" >> ipv2_scan.cc
|
---|
160 | echo "#endif" >> ipv2_scan.cc
|
---|
161 | $(FLEX) -L -t ipv2_scan.ll | grep -v "extern FILE .yyin" \
|
---|
162 | | grep -v "static int yy_get_next_buffer.*;" \
|
---|
163 | | grep -v "static int yy_get_next_buffer.*;" \
|
---|
164 | | grep -v "class istream;" \
|
---|
165 | | sed "s/static int yy_get_next_buffer/int yy_get_next_buffer/" \
|
---|
166 | | grep -v "static void yyunput.*;" \
|
---|
167 | | sed "s/static void yyunput/void yyunput/" \
|
---|
168 | | grep -v "static int yyinput.*;" \
|
---|
169 | | grep -v "extern.*isatty" \
|
---|
170 | | sed "s/static int yyinput/int yyinput/" \
|
---|
171 | >> ipv2_scan.cc
|
---|