]> git.ipfire.org Git - thirdparty/gcc.git/blame - libatomic/Makefile.am
Update copyright years.
[thirdparty/gcc.git] / libatomic / Makefile.am
CommitLineData
8d9254fc 1## Copyright (C) 2012-2020 Free Software Foundation, Inc.
48310492
RH
2## Contributed by Richard Henderson <rth@redhat.com>.
3##
4## This file is part of the GNU Atomic Library (libatomic).
5##
6## Libatomic is free software; you can redistribute it and/or modify it
7## under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 3 of the License, or
9## (at your option) any later version.
10##
11## Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
12## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13## FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14## more details.
15##
16## Under Section 7 of GPL version 3, you are granted additional
17## permissions described in the GCC Runtime Library Exception, version
18## 3.1, as published by the Free Software Foundation.
19##
20## You should have received a copy of the GNU General Public License and
21## a copy of the GCC Runtime Library Exception along with this program;
22## see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23## <http://www.gnu.org/licenses/>.
24
25ACLOCAL_AMFLAGS = -I .. -I ../config
26SUBDIRS = testsuite
27
28## May be used by toolexeclibdir.
3c36aa6b 29gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
48310492
RH
30
31config_path= @config_path@
32search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
33 $(top_srcdir) $(top_builddir)
34
35vpath % $(strip $(search_path))
36
37DEFAULT_INCLUDES = $(addprefix -I, $(search_path))
38AM_CFLAGS = $(XCFLAGS)
39AM_CCASFLAGS = $(XCFLAGS)
40AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
41
42toolexeclib_LTLIBRARIES = libatomic.la
36749a1f 43noinst_LTLIBRARIES = libatomic_convenience.la
48310492
RH
44
45if LIBAT_BUILD_VERSIONED_SHLIB
46if LIBAT_BUILD_VERSIONED_SHLIB_GNU
47libatomic_version_script = -Wl,--version-script,$(top_srcdir)/libatomic.map
48libatomic_version_dep = $(top_srcdir)/libatomic.map
49endif
50if LIBAT_BUILD_VERSIONED_SHLIB_SUN
51libatomic_version_script = -Wl,-M,libatomic.map-sun
52libatomic_version_dep = libatomic.map-sun
53libatomic.map-sun : $(top_srcdir)/libatomic.map \
54 $(top_srcdir)/../contrib/make_sunver.pl \
55 $(libatomic_la_OBJECTS) $(libatomic_la_LIBADD)
56 perl $(top_srcdir)/../contrib/make_sunver.pl \
57 $(top_srcdir)/libatomic.map \
58 $(libatomic_la_OBJECTS:%.lo=.libs/%.o) \
59 `echo $(libatomic_la_LIBADD) | \
527eeee5 60 sed 's,\([^/ ]*\)\.l\([ao]\),.libs/\1.\2,g'` \
48310492
RH
61 > $@ || (rm -f $@ ; exit 1)
62endif
63else
64libatomic_version_script =
65libatomic_version_dep =
66endif
67libatomic_version_info = -version-info $(libtool_VERSION)
68
dc3368d0 69libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
267bac10 70libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
c29c36ad 71 fenv.c fence.c flag.c
48310492
RH
72
73SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
74SIZES = @SIZES@
75
76EXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS))
77libatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep)
78
79## And now our custom target patterns that allow us not to have tons of
80## extra source files hanging about. Unfortunately, the complex relation
81## between source and object filenames doesn't allow us to add an explicit
82## dependency here. Fortunately that doesn't matter since auto-generated
83## dependencies do the job just as well:
84-include $(wildcard $(DEPDIR)/*.Ppo)
85
86## Naming pattern: base_n_i_.lo
87##
88## N size of data
89## I IFUNC alternative, index beginning at 1.
90##
91## The trailing _ in the output object file name is required to differentiate
92## these objects from those which should be compiled normally. We can only
93## have one stem in the implicit rule.
94
95empty =
96space = $(empty) $(empty)
97PAT_SPLIT = $(subst _,$(space),$(*F))
98PAT_BASE = $(word 1,$(PAT_SPLIT))
99PAT_N = $(word 2,$(PAT_SPLIT))
100PAT_S = $(word 3,$(PAT_SPLIT))
101IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
102IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
103
104M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
105M_SIZE = -DN=$(PAT_N)
106M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
107M_FILE = $(PAT_BASE)_n.c
108
109# The lack of explicit dependency on the source file means that VPATH cannot
110# work properly. Instead, perform this operation by hand. First, collect a
111# list of all .c files in the search path.
112all_c_files := $(foreach dir,$(search_path),$(wildcard $(dir)/*.c))
113
114# Then sort through them to find the one we want, and select the first.
115M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
116
117%_.lo: Makefile
118 $(LTCOMPILE) $(M_DEPS) $(M_SIZE) $(M_IFUNC) -c -o $@ $(M_SRC)
119
120## Include all of the sizes in the "normal" set of compilation flags.
121libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
122
123## On a target-specific basis, include alternates to be selected by IFUNC.
124if HAVE_IFUNC
141abc6f 125if ARCH_AARCH64_LINUX
9d0e85af 126IFUNC_OPTIONS = -march=armv8-a+lse
141abc6f
SE
127libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
128endif
48310492 129if ARCH_ARM_LINUX
e64944ac 130IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
48310492
RH
131libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
132libatomic_la_LIBADD += $(addsuffix _8_2_.lo,$(SIZEOBJS))
133endif
134if ARCH_I386
135IFUNC_OPTIONS = -march=i586
136libatomic_la_LIBADD += $(addsuffix _8_1_.lo,$(SIZEOBJS))
137endif
138if ARCH_X86_64
139IFUNC_OPTIONS = -mcx16
140libatomic_la_LIBADD += $(addsuffix _16_1_.lo,$(SIZEOBJS))
141endif
142endif
36749a1f
ILT
143
144libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)
145libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
7c961392
SN
146
147# Override the automake generated all-multi rule to guarantee that all-multi
148# is not run in parallel with the %_.lo rules which generate $(DEPDIR)/*.Ppo
149# makefile fragments to avoid broken *.Ppo getting included into the Makefile
150# when it is reloaded during the build of all-multi.
151all-multi: $(libatomic_la_LIBADD)
152 $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
22e05272
JM
153
154include $(top_srcdir)/../multilib.am