This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 01/17] Add Make-lang.in and config-lang.in to gcc/unittests
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 10 Jun 2015 11:24:42 -0400
- Subject: [PATCH 01/17] Add Make-lang.in and config-lang.in to gcc/unittests
- Authentication-results: sourceware.org; auth=none
- References: <1433949898-22033-1-git-send-email-dmalcolm at redhat dot com>
gcc/unittests/ChangeLog:
* Make-lang.in: New file.
* config-lang.in: New file.
---
gcc/unittests/Make-lang.in | 200 +++++++++++++++++++++++++++++++++++++++++++
gcc/unittests/config-lang.in | 34 ++++++++
2 files changed, 234 insertions(+)
create mode 100644 gcc/unittests/Make-lang.in
create mode 100644 gcc/unittests/config-lang.in
diff --git a/gcc/unittests/Make-lang.in b/gcc/unittests/Make-lang.in
new file mode 100644
index 0000000..50d6e4f
--- /dev/null
+++ b/gcc/unittests/Make-lang.in
@@ -0,0 +1,200 @@
+# Top level -*- makefile -*- fragment for unittests.
+# Copyright (C) 2013-2015 Free Software Foundation, Inc.
+
+#This file is part of GCC.
+
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file provides the language dependent support in the main Makefile.
+# Each language makefile fragment must provide the following targets:
+#
+# foo.all.cross, foo.start.encap, foo.rest.encap,
+# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
+# foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
+# foo.mostlyclean, foo.clean, foo.distclean,
+# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
+#
+# where `foo' is the name of the language.
+#
+# It should also provide rules for:
+#
+# - making any compiler driver (eg: g++)
+# - the compiler proper (eg: cc1plus)
+# - define the names for selecting the language in LANGUAGES.
+
+#
+# Define the names for selecting unittests in LANGUAGES.
+# Note that it would be nice to move the dependency on g++
+# into the unittests rule, but that needs a little bit of work
+# to do the right thing within all.cross.
+
+LIBGCCUNITTESTS_LINKER_NAME = libgccunittests.so
+LIBGCCUNITTESTS_VERSION_NUM = 0
+LIBGCCUNITTESTS_MINOR_NUM = 0
+LIBGCCUNITTESTS_RELEASE_NUM = 1
+LIBGCCUNITTESTS_SONAME = $(LIBGCCUNITTESTS_LINKER_NAME).$(LIBGCCUNITTESTS_VERSION_NUM)
+LIBGCCUNITTESTS_FILENAME = \
+ $(LIBGCCUNITTESTS_SONAME).$(LIBGCCUNITTESTS_MINOR_NUM).$(LIBGCCUNITTESTS_RELEASE_NUM)
+
+LIBGCCUNITTESTS_LINKER_NAME_SYMLINK = $(LIBGCCUNITTESTS_LINKER_NAME)
+LIBGCCUNITTESTS_SONAME_SYMLINK = $(LIBGCCUNITTESTS_SONAME)
+
+TESTPROGRAMS = unittests.exe
+
+RUN_TESTPROGRAMS = run-unittests.exe
+
+unittests: $(LIBGCCUNITTESTS_FILENAME) \
+ $(LIBGCCUNITTESTS_SYMLINK) \
+ $(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK) \
+ $(FULL_DRIVER_NAME) \
+ $(TESTPROGRAMS) \
+ $(RUN_TESTPROGRAMS)
+
+# Tell GNU make to ignore these if they exist.
+.PHONY: unittests $(RUN_TESTPROGRAMS)
+
+# "Frontend" objects, which go into libgccunittests.so
+unittests_OBJS = attribs.o \
+ unittests/unittests-frontend.o
+
+# Build various files against gtest
+
+# Files that are linked into unittests.exe
+UNITTESTS_EXE_OBJS = \
+ test-bitmap.o \
+ test-cfg.o \
+ test-folding.o \
+ test-functions.o \
+ test-gimple.o \
+ test-hash-map.o \
+ test-hash-set.o \
+ test-locations.o \
+ test-rtl.o \
+ test-tree.o \
+ test-vec.o \
+ test-wide-int.o \
+ unittests-main.o
+
+# Files to be built against gtest
+# test-ggc.o has to be linked in to libgccunittests.so
+OBJS_BUILT_AGAINST_GTEST = $(UNITTESTS_EXE_OBJS) test-ggc.o
+
+# All objects (for the main Makefile.in's dependency tracking)
+#extra_OBJS += $(OBJS_BUILT_AGAINST_GTEST)
+
+# Use strict warnings for this front end.
+unittests-warn = $(STRICT_WARN)
+
+# We avoid using $(BACKEND) from Makefile.in in order to avoid pulling
+# in main.o
+$(LIBGCCUNITTESTS_FILENAME): $(unittests_OBJS) \
+ libbackend.a libcommon-target.a libcommon.a \
+ $(CPPLIB) $(LIBDECNUMBER) \
+ $(LIBDEPS) test-ggc.o
+ +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \
+ $(unittests_OBJS) libbackend.a libcommon-target.a libcommon.a \
+ $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) test-ggc.o \
+ -Wl,-soname,$(LIBGCCUNITTESTS_SONAME)
+
+$(LIBGCCUNITTESTS_SONAME_SYMLINK): $(LIBGCCUNITTESTS_FILENAME)
+ ln -sf $(LIBGCCUNITTESTS_FILENAME) $(LIBGCCUNITTESTS_SONAME_SYMLINK)
+
+$(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK): $(LIBGCCUNITTESTS_SONAME_SYMLINK)
+ ln -sf $(LIBGCCUNITTESTS_SONAME_SYMLINK) $(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK)
+
+#
+# Build hooks:
+
+unittests.all.cross:
+unittests.start.encap:
+unittests.rest.encap:
+
+$(OBJS_BUILT_AGAINST_GTEST): %.o: $(srcdir)/unittests/%.c
+ $(COMPILER) \
+ $(shell gtest-config --cppflags --cxxflags) \
+ $(INCLUDES) \
+ $(ALL_COMPILERFLAGS) \
+ -c -o $@ $<
+
+unittests.exe: $(UNITTESTS_EXE_OBJS) $(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK)
+ $(LINKER) \
+ $(shell gtest-config --ldflags --libs) \
+ $(ALL_LINKERFLAGS) \
+ -L. -lgccunittests \
+ -o $@ \
+ $(UNITTESTS_EXE_OBJS) \
+ $(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK)
+
+run-unittests.exe: unittests.exe
+ LD_LIBRARY_PATH=. ./unittests.exe
+
+# Documentation build hooks.
+unittests.info:
+unittests.man:
+
+# Testing hooks:
+lang_checks += check-unittests
+
+#
+# Install hooks:
+unittests.install-common: installdirs
+ $(INSTALL_PROGRAM) $(LIBGCCUNITTESTS_FILENAME) \
+ $(DESTDIR)/$(libdir)/$(LIBGCCUNITTESTS_FILENAME)
+ ln -sf \
+ $(LIBGCCUNITTESTS_FILENAME) \
+ $(DESTDIR)/$(libdir)/$(LIBGCCUNITTESTS_SONAME_SYMLINK)
+ ln -sf \
+ $(LIBGCCUNITTESTS_SONAME_SYMLINK)\
+ $(DESTDIR)/$(libdir)/$(LIBGCCUNITTESTS_LINKER_NAME_SYMLINK)
+ $(INSTALL_PROGRAM) $(srcdir)/unittests/libgccunittests.h \
+ $(DESTDIR)/$(includedir)/libgccunittests.h
+ $(INSTALL_PROGRAM) $(srcdir)/unittests/libgccunittests++.h \
+ $(DESTDIR)/$(includedir)/libgccunittests++.h
+
+unittests.install-man:
+
+unittests.install-plugin:
+
+unittests.uninstall:
+
+#
+# Clean hooks:
+# A lot of the ancillary files are deleted by the main makefile.
+# We just have to delete files specific to us.
+
+unittests.mostlyclean:
+
+unittests.clean:
+
+unittests.distclean:
+
+unittests.maintainer-clean:
+
+#
+# Stage hooks:
+# The main makefile has already created stage?/unittests.
+
+unittests.stage1: stage1-start
+ -mv unittests/*$(objext) stage1/unittests
+unittests.stage2: stage2-start
+ -mv unittests/*$(objext) stage2/unittests
+unittests.stage3: stage3-start
+ -mv unittests/*$(objext) stage3/unittests
+unittests.stage4: stage4-start
+ -mv unittests/*$(objext) stage4/unittests
+unittests.stageprofile: stageprofile-start
+ -mv unittests/*$(objext) stageprofile/unittests
+unittests.stagefeedback: stagefeedback-start
+ -mv unittests/*$(objext) stagefeedback/unittests
diff --git a/gcc/unittests/config-lang.in b/gcc/unittests/config-lang.in
new file mode 100644
index 0000000..1e0bfd7
--- /dev/null
+++ b/gcc/unittests/config-lang.in
@@ -0,0 +1,34 @@
+# Top level configure fragment for unittests
+# Copyright (C) 2013-2015 Free Software Foundation, Inc.
+
+#This file is part of GCC.
+
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Configure looks for the existence of this file to auto-config each language.
+# We define several parameters used by configure:
+#
+# language - name of language as it would appear in $(LANGUAGES)
+# compilers - value to add to $(COMPILERS)
+
+language="unittests"
+
+compilers="unittest-suite"
+
+target_libs=""
+
+gtfiles="\$(srcdir)/unittests/unittests-frontend.c \$(srcdir)/unittests/test-ggc.c"
+
+build_by_default="no"
--
1.8.5.3