1139749Simp## Copyright (C) 2012-2015 Free Software Foundation, Inc. 239234Sgibbs## Contributed by Richard Henderson <rth@redhat.com>. 339234Sgibbs## 439234Sgibbs## This file is part of the GNU Atomic Library (libatomic). 539234Sgibbs## 639234Sgibbs## Libatomic is free software; you can redistribute it and/or modify it 739234Sgibbs## under the terms of the GNU General Public License as published by 839234Sgibbs## the Free Software Foundation; either version 3 of the License, or 939234Sgibbs## (at your option) any later version. 1039234Sgibbs## 1139234Sgibbs## Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY 1239234Sgibbs## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 1339234Sgibbs## FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1439234Sgibbs## more details. 1539234Sgibbs## 1639234Sgibbs## Under Section 7 of GPL version 3, you are granted additional 1739234Sgibbs## permissions described in the GCC Runtime Library Exception, version 1839234Sgibbs## 3.1, as published by the Free Software Foundation. 1939234Sgibbs## 2039234Sgibbs## You should have received a copy of the GNU General Public License and 2139234Sgibbs## a copy of the GCC Runtime Library Exception along with this program; 2239234Sgibbs## see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 2339234Sgibbs## <http://www.gnu.org/licenses/>. 2439234Sgibbs 2539234SgibbsACLOCAL_AMFLAGS = -I .. -I ../config 2639234SgibbsSUBDIRS = testsuite 2739234Sgibbs 2839234Sgibbs## May be used by toolexeclibdir. 29201807Straszgcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) 3039234Sgibbs 3139234Sgibbsconfig_path= @config_path@ 3239234Sgibbssearch_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \ 3339234Sgibbs $(top_srcdir) $(top_builddir) 3439234Sgibbs 3539234Sgibbsvpath % $(strip $(search_path)) 3639234Sgibbs 3739234SgibbsDEFAULT_INCLUDES = $(addprefix -I, $(search_path)) 3839234SgibbsAM_CFLAGS = $(XCFLAGS) 3939234SgibbsAM_CCASFLAGS = $(XCFLAGS) 4039234SgibbsAM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) 4139234Sgibbs 4239234Sgibbstoolexeclib_LTLIBRARIES = libatomic.la 4339234Sgibbsnoinst_LTLIBRARIES = libatomic_convenience.la 4439234Sgibbs 4539234Sgibbsif LIBAT_BUILD_VERSIONED_SHLIB 4639234Sgibbsif LIBAT_BUILD_VERSIONED_SHLIB_GNU 4739234Sgibbslibatomic_version_script = -Wl,--version-script,$(top_srcdir)/libatomic.map 4839234Sgibbslibatomic_version_dep = $(top_srcdir)/libatomic.map 4939234Sgibbsendif 5039234Sgibbsif LIBAT_BUILD_VERSIONED_SHLIB_SUN 5139234Sgibbslibatomic_version_script = -Wl,-M,libatomic.map-sun 5239234Sgibbslibatomic_version_dep = libatomic.map-sun 5339234Sgibbslibatomic.map-sun : $(top_srcdir)/libatomic.map \ 5439234Sgibbs $(top_srcdir)/../contrib/make_sunver.pl \ 5539234Sgibbs $(libatomic_la_OBJECTS) $(libatomic_la_LIBADD) 5639234Sgibbs perl $(top_srcdir)/../contrib/make_sunver.pl \ 5739234Sgibbs $(top_srcdir)/libatomic.map \ 5839234Sgibbs $(libatomic_la_OBJECTS:%.lo=.libs/%.o) \ 5939234Sgibbs `echo $(libatomic_la_LIBADD) | \ 6039234Sgibbs sed 's,\([^/ ]*\)\.l\([ao]\),.libs/\1.\2,g'` \ 6139234Sgibbs > $@ || (rm -f $@ ; exit 1) 6239234Sgibbsendif 6339234Sgibbselse 6439234Sgibbslibatomic_version_script = 6539234Sgibbslibatomic_version_dep = 6639234Sgibbsendif 6739234Sgibbslibatomic_version_info = -version-info $(libtool_VERSION) 6839234Sgibbs 6939234Sgibbslibatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags) 7039234Sgibbslibatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \ 7139234Sgibbs fenv.c 7239234Sgibbs 7339234SgibbsSIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas 7439234SgibbsSIZES = @SIZES@ 7539234Sgibbs 7639234SgibbsEXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS)) 7739234Sgibbslibatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep) 7839234Sgibbs 7939234Sgibbs## And now our custom target patterns that allow us not to have tons of 8039234Sgibbs## extra source files hanging about. Unfortunately, the complex relation 8139234Sgibbs## between source and object filenames doesn't allow us to add an explicit 8239234Sgibbs## dependency here. Fortunately that doesn't matter since auto-generated 8339234Sgibbs## dependencies do the job just as well: 8439234Sgibbs-include $(wildcard $(DEPDIR)/*.Ppo) 8539234Sgibbs 8639234Sgibbs## Naming pattern: base_n_i_.lo 8739234Sgibbs## 8839234Sgibbs## N size of data 8939234Sgibbs## I IFUNC alternative, index beginning at 1. 9039515Sgibbs## 9139234Sgibbs## The trailing _ in the output object file name is required to differentiate 9239234Sgibbs## these objects from those which should be compiled normally. We can only 9339234Sgibbs## have one stem in the implicit rule. 9439234Sgibbs 9539234Sgibbsempty = 9639234Sgibbsspace = $(empty) $(empty) 9739234SgibbsPAT_SPLIT = $(subst _,$(space),$(*F)) 9839234SgibbsPAT_BASE = $(word 1,$(PAT_SPLIT)) 9939234SgibbsPAT_N = $(word 2,$(PAT_SPLIT)) 10039234SgibbsPAT_S = $(word 3,$(PAT_SPLIT)) 10139234SgibbsIFUNC_DEF = -DIFUNC_ALT=$(PAT_S) 10239234SgibbsIFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS)) 10339234Sgibbs 10439234SgibbsM_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo 10539234SgibbsM_SIZE = -DN=$(PAT_N) 10639234SgibbsM_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT)) 10739234SgibbsM_FILE = $(PAT_BASE)_n.c 10839234Sgibbs 10939234Sgibbs# The lack of explicit dependency on the source file means that VPATH cannot 11039234Sgibbs# work properly. Instead, perform this operation by hand. First, collect a 11139234Sgibbs# list of all .c files in the search path. 11239234Sgibbsall_c_files := $(foreach dir,$(search_path),$(wildcard $(dir)/*.c)) 11339234Sgibbs 11439234Sgibbs# Then sort through them to find the one we want, and select the first. 11539234SgibbsM_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) 11639234Sgibbs 11739234Sgibbs%_.lo: Makefile 11839234Sgibbs $(LTCOMPILE) $(M_DEPS) $(M_SIZE) $(M_IFUNC) -c -o $@ $(M_SRC) 11939234Sgibbs 12039234Sgibbs## Include all of the sizes in the "normal" set of compilation flags. 12139234Sgibbslibatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS))) 12239234Sgibbs 12339234Sgibbs## On a target-specific basis, include alternates to be selected by IFUNC. 12439234Sgibbsif HAVE_IFUNC 12539234Sgibbsif ARCH_ARM_LINUX 12639234SgibbsIFUNC_OPTIONS = -march=armv7-a -DHAVE_KERNEL64 12739234Sgibbslibatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS))) 12839234Sgibbslibatomic_la_LIBADD += $(addsuffix _8_2_.lo,$(SIZEOBJS)) 12939234Sgibbsendif 13039234Sgibbsif ARCH_I386 13139234SgibbsIFUNC_OPTIONS = -march=i586 13239234Sgibbslibatomic_la_LIBADD += $(addsuffix _8_1_.lo,$(SIZEOBJS)) 13339234Sgibbsendif 13439234Sgibbsif ARCH_X86_64 13539234SgibbsIFUNC_OPTIONS = -mcx16 13639234Sgibbslibatomic_la_LIBADD += $(addsuffix _16_1_.lo,$(SIZEOBJS)) 13739234Sgibbsendif 13839234Sgibbsendif 13939234Sgibbs 14039234Sgibbslibatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES) 14139234Sgibbslibatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD) 14239234Sgibbs 14339234Sgibbs# Override the automake generated all-multi rule to guarantee that all-multi 14439234Sgibbs# is not run in parallel with the %_.lo rules which generate $(DEPDIR)/*.Ppo 145234540Sdim# makefile fragments to avoid broken *.Ppo getting included into the Makefile 14639234Sgibbs# when it is reloaded during the build of all-multi. 14739234Sgibbsall-multi: $(libatomic_la_LIBADD) 14839234Sgibbs $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE) 14939234Sgibbs