1 ## Makefile for the Phobos standard library.
2 ## Copyright (C) 2012-2018 Free Software Foundation, Inc.
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)
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 # Include D build rules
19 include $(top_srcdir)/d_rules.am
21 # Make sure GDC can find libdruntime and libphobos include files
22 D_EXTRA_DFLAGS=-nostdinc -I $(srcdir) \
23 -I $(top_srcdir)/libdruntime -I ../libdruntime -I .
25 # C flags for zlib compilation
26 AM_CFLAGS=@DEFS@ -I. -I$(srcdir)/../libdruntime/gcc -I$(top_srcdir)/../zlib
28 # D flags for compilation
29 AM_DFLAGS=$(phobos_compiler_pic_flag)
32 ALL_PHOBOS_INSTALL_DSOURCES = $(PHOBOS_DSOURCES)
34 # Setup source files depending on configure
35 ALL_PHOBOS_COMPILE_DSOURCES = $(PHOBOS_DSOURCES)
37 ALL_PHOBOS_SOURCES = $(ALL_PHOBOS_COMPILE_DSOURCES)
38 PHOBOS_TEST_LOBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.lo)
39 PHOBOS_TEST_OBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.o)
41 # Main library build definitions
42 if DRUNTIME_ZLIB_SYSTEM
45 ZLIB_SRC = $(ZLIB_CSOURCES)
49 check_LTLIBRARIES = libgphobos_t.la
50 check_PROGRAMS += unittest
53 check_PROGRAMS += unittest_static
56 toolexeclib_DATA = libgphobos.spec
57 toolexeclib_LTLIBRARIES = libgphobos.la
58 libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC)
59 libgphobos_la_LIBTOOLFLAGS =
60 libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(PHOBOS_SOVERSION)
61 libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
62 libgphobos_la_DEPENDENCIES = libgphobos.spec
64 # For static unittest, link objects directly
65 unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
66 unittest_static_LIBTOOLFLAGS =
67 unittest_static_LDFLAGS = -Xcompiler -nophoboslib -static-libtool-libs
68 unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
69 ../libdruntime/libgdruntime.la
70 EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
72 # For unittest with dynamic library
73 libgphobos_t_la_SOURCES = $(ZLIB_SRC)
74 libgphobos_t_la_LIBTOOLFLAGS =
75 libgphobos_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
76 libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
77 ../libdruntime/libgdruntime.la
78 EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
81 unittest_SOURCES = ../testsuite/test_runner.d
82 unittest_LIBTOOLFLAGS =
83 unittest_LDFLAGS = -Xcompiler -nophoboslib -shared
84 unittest_LDADD = libgphobos_t.la ../libdruntime/libgdruntime.la
86 # Extra install and clean rules.
87 # This does not delete the .libs/.t.o files, but deleting
88 # the .lo is good enough to rerun the rules
90 rm -f $(PHOBOS_TEST_LOBJECTS)
91 rm -f $(PHOBOS_TEST_OBJECTS)
93 # Handles generated files as well
95 for file in $(ALL_PHOBOS_INSTALL_DSOURCES); do \
96 if test -f $$file; then \
97 $(INSTALL_HEADER) -D $$file $(DESTDIR)$(gdc_include_dir)/$$file ; \
99 $(INSTALL_HEADER) -D $(srcdir)/$$file \
100 $(DESTDIR)$(gdc_include_dir)/$$file ; \
104 # Zlib sources when not using system libz
105 ZLIB_CSOURCES=$(top_srcdir)/../zlib/adler32.c $(top_srcdir)/../zlib/compress.c \
106 $(top_srcdir)/../zlib/crc32.c $(top_srcdir)/../zlib/deflate.c \
107 $(top_srcdir)/../zlib/gzclose.c $(top_srcdir)/../zlib/gzlib.c \
108 $(top_srcdir)/../zlib/gzread.c $(top_srcdir)/../zlib/gzwrite.c \
109 $(top_srcdir)/../zlib/infback.c $(top_srcdir)/../zlib/inffast.c \
110 $(top_srcdir)/../zlib/inflate.c $(top_srcdir)/../zlib/inftrees.c \
111 $(top_srcdir)/../zlib/trees.c $(top_srcdir)/../zlib/uncompr.c \
112 $(top_srcdir)/../zlib/zutil.c
114 # Source file definitions. Boring stuff, auto-generated with
115 # https://gist.github.com/jpf91/8744acebc9dcf1e9d1a35cdff20afbb2
116 # Can't use wildcards here:
117 # https://www.gnu.org/software/automake/manual/html_node/Wildcards.html
118 PHOBOS_DSOURCES = etc/c/curl.d etc/c/sqlite3.d etc/c/zlib.d \
119 std/algorithm/comparison.d std/algorithm/internal.d \
120 std/algorithm/iteration.d std/algorithm/mutation.d \
121 std/algorithm/package.d std/algorithm/searching.d \
122 std/algorithm/setops.d std/algorithm/sorting.d std/array.d std/ascii.d \
123 std/base64.d std/bigint.d std/bitmanip.d std/compiler.d std/complex.d \
124 std/concurrency.d std/container/array.d std/container/binaryheap.d \
125 std/container/dlist.d std/container/package.d std/container/rbtree.d \
126 std/container/slist.d std/container/util.d std/conv.d std/csv.d \
127 std/datetime/date.d std/datetime/interval.d std/datetime/package.d \
128 std/datetime/stopwatch.d std/datetime/systime.d \
129 std/datetime/timezone.d std/demangle.d std/digest/crc.d \
130 std/digest/digest.d std/digest/hmac.d std/digest/md.d \
131 std/digest/murmurhash.d std/digest/package.d std/digest/ripemd.d \
132 std/digest/sha.d std/encoding.d std/exception.d \
133 std/experimental/allocator/building_blocks/affix_allocator.d \
134 std/experimental/allocator/building_blocks/allocator_list.d \
135 std/experimental/allocator/building_blocks/bitmapped_block.d \
136 std/experimental/allocator/building_blocks/bucketizer.d \
137 std/experimental/allocator/building_blocks/fallback_allocator.d \
138 std/experimental/allocator/building_blocks/free_list.d \
139 std/experimental/allocator/building_blocks/free_tree.d \
140 std/experimental/allocator/building_blocks/kernighan_ritchie.d \
141 std/experimental/allocator/building_blocks/null_allocator.d \
142 std/experimental/allocator/building_blocks/package.d \
143 std/experimental/allocator/building_blocks/quantizer.d \
144 std/experimental/allocator/building_blocks/region.d \
145 std/experimental/allocator/building_blocks/scoped_allocator.d \
146 std/experimental/allocator/building_blocks/segregator.d \
147 std/experimental/allocator/building_blocks/stats_collector.d \
148 std/experimental/allocator/common.d \
149 std/experimental/allocator/gc_allocator.d \
150 std/experimental/allocator/mallocator.d \
151 std/experimental/allocator/mmap_allocator.d \
152 std/experimental/allocator/package.d \
153 std/experimental/allocator/showcase.d \
154 std/experimental/allocator/typed.d std/experimental/checkedint.d \
155 std/experimental/logger/core.d std/experimental/logger/filelogger.d \
156 std/experimental/logger/multilogger.d \
157 std/experimental/logger/nulllogger.d std/experimental/logger/package.d \
158 std/experimental/typecons.d std/file.d std/format.d std/functional.d \
159 std/getopt.d std/internal/cstring.d std/internal/digest/sha_SSSE3.d \
160 std/internal/math/biguintcore.d std/internal/math/biguintnoasm.d \
161 std/internal/math/biguintx86.d std/internal/math/errorfunction.d \
162 std/internal/math/gammafunction.d std/internal/scopebuffer.d \
163 std/internal/test/dummyrange.d std/internal/test/range.d \
164 std/internal/test/uda.d std/internal/unicode_comp.d \
165 std/internal/unicode_decomp.d std/internal/unicode_grapheme.d \
166 std/internal/unicode_norm.d std/internal/unicode_tables.d \
167 std/internal/windows/advapi32.d std/json.d std/math.d \
168 std/mathspecial.d std/meta.d std/mmfile.d std/net/curl.d \
169 std/net/isemail.d std/numeric.d std/outbuffer.d std/parallelism.d \
170 std/path.d std/process.d std/random.d std/range/interfaces.d \
171 std/range/package.d std/range/primitives.d \
172 std/regex/internal/backtracking.d std/regex/internal/generator.d \
173 std/regex/internal/ir.d std/regex/internal/kickstart.d \
174 std/regex/internal/parser.d std/regex/internal/tests.d \
175 std/regex/internal/thompson.d std/regex/package.d std/signals.d \
176 std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d \
177 std/traits.d std/typecons.d std/typetuple.d std/uni.d std/uri.d \
178 std/utf.d std/uuid.d std/variant.d std/windows/charset.d \
179 std/windows/registry.d std/windows/syserror.d std/xml.d std/zip.d \