1#
2#    This source code is free software; you can redistribute it
3#    and/or modify it in source code form under the terms of the GNU
4#    Library General Public License as published by the Free Software
5#    Foundation; either version 2 of the License, or (at your option)
6#    any later version.
7#
8#    This program is distributed in the hope that it will be useful,
9#    but WITHOUT ANY WARRANTY; without even the implied warranty of
10#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11#    GNU Library General Public License for more details.
12#
13#    You should have received a copy of the GNU Library General Public
14#    License along with this program; if not, write to the Free
15#    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16#    Boston, MA 02110-1301, USA.
17#
18SHELL = /bin/sh
19
20suffix = @install_suffix@
21
22prefix = @prefix@
23prefix = @prefix@
24exec_prefix = @exec_prefix@
25srcdir = @srcdir@
26
27VPATH = $(srcdir)
28
29bindir = @bindir@
30libdir = @libdir@
31includedir = $(prefix)/include
32
33CXX = @CXX@
34INSTALL = @INSTALL@
35INSTALL_PROGRAM = @INSTALL_PROGRAM@
36INSTALL_DATA = @INSTALL_DATA@
37
38ifeq (@srcdir@,.)
39INCLUDE_PATH = -I. -I..
40else
41INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/..
42endif
43
44CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ @PICFLAG@
45CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
46LDFLAGS = @LDFLAGS@
47
48O = vhdl.o state.o vhdl_element.o vhdl_type.o vhdl_syntax.o scope.o process.o \
49    stmt.o expr.o lpm.o support.o cast.o logic.o
50
51all: dep vhdl.tgt vhdl.conf vhdl-s.conf
52
53check: all
54
55clean:
56	rm -rf $(O) dep vhdl.tgt
57
58distclean: clean
59	rm -f Makefile config.log
60	rm -f stamp-vhdl_config-h vhdl_config.h
61
62cppcheck: $(O:.o=.cc)
63	cppcheck --enable=all --std=posix --std=c99 --std=c++03 -f \
64	         --suppressions-list=$(srcdir)/cppcheck.sup \
65	         --relative-paths=$(srcdir) $(INCLUDE_PATH) $^
66
67Makefile: $(srcdir)/Makefile.in ../config.status
68	cd ..; ./config.status --file=tgt-vhdl/$@
69
70dep:
71	mkdir dep
72
73%.o: %.cc vhdl_config.h
74	$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
75	mv $*.d dep
76
77ifeq (@WIN32@,yes)
78  TGTLDFLAGS=-L.. -livl
79  TGTDEPLIBS=../libivl.a
80else
81  TGTLDFLAGS=
82  TGTDEPLIBS=
83endif
84
85vhdl.tgt: $O $(TGTDEPLIBS)
86	$(CXX) @shared@ $(LDFLAGS) -o $@ $O $(TGTLDFLAGS)
87
88stamp-vhdl_config-h: $(srcdir)/vhdl_config.h.in ../config.status
89	@rm -f $@
90	cd ..; ./config.status --header=tgt-vhdl/vhdl_config.h
91vhdl_config.h: stamp-vhdl_config-h
92
93install: all installdirs installfiles
94
95F = ./vhdl.tgt \
96	$(srcdir)/vhdl.conf \
97	$(srcdir)/vhdl-s.conf
98
99installfiles: $(F) | installdirs
100	$(INSTALL_PROGRAM) ./vhdl.tgt "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl.tgt"
101	$(INSTALL_DATA) $(srcdir)/vhdl.conf "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl.conf"
102	$(INSTALL_DATA) $(srcdir)/vhdl-s.conf "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl-s.conf"
103
104installdirs: $(srcdir)/../mkinstalldirs
105	$(srcdir)/../mkinstalldirs "$(DESTDIR)$(libdir)/ivl$(suffix)"
106
107uninstall:
108	rm -f "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl.tgt" "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl.conf" "$(DESTDIR)$(libdir)/ivl$(suffix)/vhdl-s.conf"
109
110
111-include $(patsubst %.o, dep/%.d, $O)
112