local.mk revision 1.1.1.1
1## The IGEN simulator generator for GDB, the GNU Debugger.
2##
3## Copyright 2002-2023 Free Software Foundation, Inc.
4##
5## Contributed by Andrew Cagney.
6##
7## This file is part of GDB.
8##
9## This program is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation; either version 3 of the License, or
12## (at your option) any later version.
13##
14## This program is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17## GNU General Public License for more details.
18##
19## You should have received a copy of the GNU General Public License
20## along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22# igen leaks memory, and therefore makes AddressSanitizer unhappy.  Disable
23# leak detection while running it.
24IGEN = %D%/igen$(EXEEXT)
25IGEN_RUN = ASAN_OPTIONS=detect_leaks=0 $(IGEN)
26
27## This makes sure igen is available before building the arch-subdirs which
28## need to run the igen tool.
29SIM_ALL_RECURSIVE_DEPS += $(IGEN)
30
31# Alias for developers.
32igen: $(IGEN)
33
34noinst_LIBRARIES += %D%/libigen.a
35%C%_libigen_a_SOURCES = \
36	%D%/table.c \
37	%D%/lf.c \
38	%D%/misc.c \
39	%D%/filter_host.c \
40	%D%/ld-decode.c \
41	%D%/ld-cache.c \
42	%D%/filter.c \
43	%D%/ld-insn.c \
44	%D%/gen-model.c \
45	%D%/gen-itable.c \
46	%D%/gen-icache.c \
47	%D%/gen-semantics.c \
48	%D%/gen-idecode.c \
49	%D%/gen-support.c \
50	%D%/gen-engine.c \
51	%D%/gen.c
52
53%C%_igen_SOURCES = %D%/igen.c
54%C%_igen_LDADD = %D%/libigen.a
55
56# These rules are copied from automake, but tweaked to use FOR_BUILD variables.
57igen/libigen.a: $(igen_libigen_a_OBJECTS) $(igen_libigen_a_DEPENDENCIES) $(EXTRA_igen_libigen_a_DEPENDENCIES) igen/$(am__dirstamp)
58	$(AM_V_at)-rm -f $@
59	$(AM_V_AR)$(AR_FOR_BUILD) $(ARFLAGS) $@ $(igen_libigen_a_OBJECTS) $(igen_libigen_a_LIBADD)
60	$(AM_V_at)$(RANLIB_FOR_BUILD) $@
61
62%D%/igen$(EXEEXT): $(%C%_igen_OBJECTS) $(%C%_igen_DEPENDENCIES) %D%/$(am__dirstamp)
63	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_igen_OBJECTS) $(%C%_igen_LDADD)
64
65# igen is a build-time only tool.  Override the default rules for it.
66%D%/%.o: %D%/%.c
67	$(AM_V_CC)$(COMPILE_FOR_BUILD) -c $< -o $@
68
69# Build some of the files in standalone mode for developers of igen itself.
70%D%/%-main.o: %D%/%.c
71	$(AM_V_CC)$(COMPILE_FOR_BUILD) -DMAIN -c $< -o $@
72
73%C%_filter_SOURCES =
74%C%_filter_LDADD = %D%/filter-main.o %D%/libigen.a
75
76%C%_gen_SOURCES =
77%C%_gen_LDADD = %D%/gen-main.o %D%/libigen.a
78
79%C%_ld_cache_SOURCES =
80%C%_ld_cache_LDADD = %D%/ld-cache-main.o %D%/libigen.a
81
82%C%_ld_decode_SOURCES =
83%C%_ld_decode_LDADD = %D%/ld-decode-main.o %D%/libigen.a
84
85%C%_ld_insn_SOURCES =
86%C%_ld_insn_LDADD = %D%/ld-insn-main.o %D%/libigen.a
87
88%C%_table_SOURCES =
89%C%_table_LDADD = %D%/table-main.o %D%/libigen.a
90
91%C%_IGEN_TOOLS = \
92	$(IGEN) \
93	%D%/filter \
94	%D%/gen \
95	%D%/ld-cache \
96	%D%/ld-decode \
97	%D%/ld-insn \
98	%D%/table
99EXTRA_PROGRAMS += $(%C%_IGEN_TOOLS)
100MOSTLYCLEANFILES += $(%C%_IGEN_TOOLS)
101