arm: Replace calls to __builtin_vneg* by - in arm_neon.h [PR66791]
[official-gcc.git] / libcody / Makefile.in
blob4b457adc3a4fe57b3412708bba941c8ff84e4667
1 # Nathan's generic Makefile -*- mode:Makefile -*-
2 # Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org
3 # License: Apache v2.0
5 ifeq (0,$(MAKELEVEL))
6 ifneq (,@tools@)
7 $(info Prepending @tools@/bin to PATH)
8 PATH := @tools@/bin:$(PATH)
9 export PATH
10 endif
11 ifeq (,$(SERIAL))
12 # Figure out if we should set parallelism
13 ifeq (,$(filter clean%,$(MAKECMDGOALS)))
14 PARALLELISM := @NUM_CPUS@
15 endif
16 endif
17 endif
19 ifeq (00,$(MAKELEVEL)$(if $(PARALLELISM),0,1))
20 # Although Make 4.3 documentation suggests I can set parallelism just
21 # by appending to MAKEFLAGS, it doesn't seem to work. It's also not
22 # possible to figure out the current Make invocation's parallelism,
23 # the -j option doesn't appear in MAKEFLAGS and is magically inserted
24 # when that is expanded in a rule. I can't figure how to get a rule
25 # expansion into a variable to test. Fortunately, Make propagates an
26 # incoming -j option rather than the one you attempted to append
27 $(info Parallelizing $(PARALLELISM) ways)
28 MAKEFLAGS += -j$(PARALLELISM)
29 ifneq (,$(MAKECMDGOALS))
30 $(MAKECMDGOALS): recurse
31 endif
32 recurse:
33 $(MAKE) -r$(MAKEFLAGS) $(MAKECMDGOALS)
34 .PHONY: recurse
35 else
37 srcdir := @srcdir@
38 prefix := @prefix@
39 exec_prefix := @exec_prefix@
40 bindir := @bindir@
41 libdir := @libdir@
42 includedir := @includedir@
43 SUBDIRS := @SUBDIRS@
44 # autoconf doesn't seem to like setting SHELL
45 SHELL := $(shell which zsh 2>/dev/null >/dev/null && echo zsh \
46 || (echo "No ZSH, maybe flakey" >&2 && echo sh))
48 # We have to place the -I paths last, so that building will see -I paths to us
49 CXX := $(filter-out -I%,@CXX@)
50 AR := @AR@
51 INSTALL := $(srcdir)/build-aux/install-sh
53 # C++ compiler options
54 CXXFLAGS := @CXXFLAGS@
55 CXXINC := $(filter -I%,@CXX@)
56 CXXOPTS := $(CXXFLAGS)
57 ifeq ($(notdir $(firstword $(CXX))),g++)
58 # It's GCC, or pretending to be it -- so it better smell like it!
59 # Code generation
60 CXXOPTS += -fno-enforce-eh-specs
61 CXXOPTS += -fno-stack-protector -fno-threadsafe-statics
62 ifneq (@EXCEPTIONS@,yes)
63 CXXOPTS += -fno-exceptions -fno-rtti
64 endif
65 ifeq ($(filter -fdebug-prefix-map=%,$(CXXOPTS)),)
66 CXXOPTS += -fdebug-prefix-map=${srcdir}/=
67 endif
68 # Warning options
69 CXXOPTS += -W -Wall
70 ifeq (no,)
71 # just turn off for now
72 CXXOPTS += -Woverloaded-virtual -Wshadow
73 CXXOPTS += -Wno-invalid-offsetof -Wno-unused-variable
74 CXXOPTS += -Wno-missing-field-initializers
75 # Diagnostic options, look at controlling terminal so that piping
76 # through more works
77 MLEN := $(shell stty size </dev/tty 2>/dev/null | cut -d' ' -f2)
78 ifneq (,$(MLEN))
79 CXXOPTS += -fmessage-length=$(MLEN)
80 endif
81 CXXOPTS += -fdiagnostics-color=always -fno-diagnostics-show-option
82 endif
83 else
84 ifeq ($(notdir $(firstword $(CXX))),clang++)
85 CXXOPTS += -fno-stack-protector -fno-threadsafe-statics
86 ifneq (@EXCEPTIONS@,yes)
87 CXXOPTS += -fno-exceptions -fno-rtti
88 endif
89 # Warning options
90 CXXOPTS += -W -Wall -Woverloaded-virtual -Wshadow
91 CXXOPTS += -Wno-invalid-offsetof -Wno-unused-variable
92 CXXOPTS += -Wno-missing-field-initializers
93 else
94 # Add different compiler's options here
95 endif
96 endif
98 # Config
99 CXXOPTS += $(filter-out -DHAVE_CONFIG_H,@DEFS@) -include config.h
101 # Linker options
102 LDFLAGS := -L. @LDFLAGS@
103 LIBS := @LIBS@
105 # Per-source & per-directory compile flags (warning: recursive)
106 SRC_CXXFLAGS = $(CXXFLAGS$(patsubst $(srcdir)%,%,$1)) \
107 $(if $(filter-out $(srcdir)/,$1),\
108 $(call $0,$(dir $(patsubst %/,%,$1))))
110 ifneq ($(MAINTAINER),)
111 override MAINTAINER += $1
112 endif
113 ifeq (@MAINTAINER@,yes)
114 MAINTAINER = $2
115 else
116 MAINTAINER = \# --enable-maintainer-mode to rebuild $1, or make MAINTAINER=touch
117 endif
119 vpath %.in $(srcdir)
120 vpath %.cc $(srcdir)
122 .SUFFIXES: .o .cc
124 %.o: %.cc
125 @mkdir -p $(dir $@)
126 $(CXX) $(strip $(CXXOPTS) $(call SRC_CXXFLAGS,$<) $(CXXINC)) \
127 -MMD -MP -MF ${@:.o=.d} -c -o $@ $<
129 all:: Makefile $(addprefix all.,$(SUBDIRS))
131 check:: Makefile $(addprefix check.,$(SUBDIRS))
133 clean:: Makefile $(addprefix clean.,$(SUBDIRS))
135 revision.stamp: $(addprefix $(srcdir)/,. $(SUBDIRS))
136 @revision=$$(git -C $(srcdir) rev-parse HEAD 2>/dev/null) ;\
137 if test -n "$$revision" ;\
138 then revision=git-$$revision ;\
139 if git -C $(srcdir) status --porcelain 2>/dev/null | grep -vq '^ ' ;\
140 then revision+=M ;\
141 fi ;\
142 else revision=unknown ;\
143 fi ;\
144 echo $$revision > $@
146 revision: revision.stamp
147 @cmp -s $< $@ || cp -f $< $@
149 clean::
150 rm -f revision.stamp revision
152 distclean:: clean
153 rm -f config.log config.status
154 rm -rf $(SUBDIRS)
156 $(srcdir)/configure: $(srcdir)/configure.ac \
157 $(patsubst %,$(srcdir)/%/config.m4,. $(SUBDIRS))
158 $(call MAINTAINER,$@,cd $(@D) && autoconf -W all,error)
160 $(srcdir)/config.h.in: $(srcdir)/configure.ac \
161 $(patsubst %,$(srcdir)/%/config.m4,. $(SUBDIRS))
162 $(call MAINTAINER,$@,cd $(@D) && autoheader -f -W all,error)
164 config.h: config.status config.h.in
165 ./$< --header=$@
166 touch $@
168 ifeq ($(filter %clean,$(MAKECMDGOALS)),)
169 @CONFIG_FILES@: %: config.status %.in
170 ./$< --file=$@
171 touch $@
172 endif
174 config.status: $(srcdir)/configure $(srcdir)/config.h.in
175 if test -x $@; then ./$@ -recheck; else $< @configure_args@; fi
177 distclean:: clean
178 rm -f config.h
180 maintainer-clean:: distclean
181 rm -f $(srcdir)/config.h.in
183 clean::
184 rm -f $(shell find $(srcdir) -name '*~')
186 .PHONY: all check clean distclean maintainer-clean
188 -include $(addsuffix /Makesub,. $(SUBDIRS))
189 -include $(addsuffix /tests/Makesub,. $(SUBDIRS))
191 endif