annotate libatomic/Makefile.am @ 158:494b0b89df80 default tip

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