PR rtl-optimization/88018
[official-gcc.git] / libphobos / d_rules.am
blob6566230c3017cc0d1ff2f1450742f30797d7e893
1 ## Common rules for D source compilation used in all Makefile.am's.
2 ## Copyright (C) 2016-2018 Free Software Foundation, Inc.
3 ##
4 ## GCC is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 3, or (at your option)
7 ## any later version.
8 ##
9 ## GCC is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with GCC; see the file COPYING3.  If not see
16 ## <http://www.gnu.org/licenses/>.
18 # If there are no sources with known extension (i.e. only D sources)
19 # automake forgets to set this
20 CCLD = $(CC)
22 toolexecdir = $(libphobos_toolexecdir)
23 toolexeclibdir = $(libphobos_toolexeclibdir)
25 # Compile D into normal object files
26 .d.o:
27         $(GDC) $(GDCFLAGS) $(MULTIFLAGS) $(D_EXTRA_DFLAGS) -c -o $@ $<
29 # Compile D sources with libtool
30 .d.lo:
31         $(LTDCOMPILE) $(GDCFLAGS) $(MULTIFLAGS) $(D_EXTRA_DFLAGS) -c -o $@ $<
33 LTDCOMPILE = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
34         --mode=compile $(GDC) $(AM_DFLAGS)
36 # Unittest rules. Unfortunately we can't use _DFLAGS in automake without
37 # explicit D support, so use this hack.
38 # Compile D sources with libtool and test flags
39 %.t.lo : %.d
40         $(LTDCOMPILE) $(GDCFLAGSX) $(MULTIFLAGS) $(D_EXTRA_DFLAGS) -c -o $@ $<
42 # Compile objects for static linking with test flags
43 # Automake breaks empty rules, so use the shell NOP :
44 %.t.o : %.t.lo
45         @:
47 # Override executable linking commands: We have to use GDC for linking
48 # to make sure we link pthreads and other dependencies
49 unittest_static_LINK = $(LIBTOOL) --tag=D \
50         $(unittest_static_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
51         $(GDC) $(AM_CFLAGS) $(CFLAGS) $(unittest_static_LDFLAGS) \
52         $(LDFLAGS) -o $@
54 unittest_LINK = $(LIBTOOL) --tag=D \
55         $(unittest_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
56         $(GDC) $(AM_CFLAGS) $(CFLAGS) $(unittest_LDFLAGS) \
57         $(LDFLAGS) -o $@
59 # Also override library link commands: This is not strictly
60 # required, but we want to record additional dependencies such
61 # as pthread in the library
62 libgdruntime_la_LINK = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) \
63         $(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
64         $(libgdruntime_la_LDFLAGS) $(LDFLAGS) -o $@
66 libgdruntime_t_la_LINK = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) \
67         $(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
68         $(libgdruntime_t_la_LDFLAGS) $(LDFLAGS) -o $@
70 libgphobos_la_LINK = $(LIBTOOL) --tag=D $(libgphobos_la_LIBTOOLFLAGS) \
71         $(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
72         $(libgphobos_la_LDFLAGS) $(LDFLAGS) -o $@
74 libgphobos_t_la_LINK = $(LIBTOOL) --tag=D \
75         $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
76         $(GDC) $(AM_CFLAGS) $(CFLAGS) $(libgphobos_t_la_LDFLAGS) \
77         $(LDFLAGS) -o $@