Commit | Line | Data |
---|---|---|
58b72d7e DE |
1 | # Makefile template for Configure for simulator common parts |
2 | # Copyright (C) 1996 Free Software Foundation, Inc. | |
3 | # | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | default: all | |
19 | ||
20 | VPATH = @srcdir@ | |
21 | srcdir = @srcdir@ | |
22 | srcroot = $(srcdir)/../.. | |
23 | ||
24 | prefix = @prefix@ | |
25 | exec_prefix = @exec_prefix@ | |
26 | ||
27 | host_alias = @host_alias@ | |
28 | target_alias = @target_alias@ | |
29 | program_transform_name = @program_transform_name@ | |
30 | bindir = @bindir@ | |
31 | ||
32 | libdir = @libdir@ | |
33 | tooldir = $(libdir)/$(target_alias) | |
34 | ||
35 | datadir = @datadir@ | |
36 | mandir = @mandir@ | |
37 | man1dir = $(mandir)/man1 | |
38 | infodir = @infodir@ | |
39 | includedir = @includedir@ | |
40 | ||
41 | SHELL = /bin/sh | |
42 | ||
43 | INSTALL = $(srcroot)/install.sh -c | |
44 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
45 | INSTALL_DATA = @INSTALL_DATA@ | |
46 | INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' | |
47 | INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1 | |
48 | ||
49 | CC = @CC@ | |
50 | CC_FOR_BUILD = @CC_FOR_BUILD@ | |
51 | CPP = @CPP@ | |
52 | CPP_FOR_TARGET = @CPP_FOR_TARGET@ | |
53 | TARGET_SUBDIR = @TARGET_SUBDIR@ | |
54 | CFLAGS = @CFLAGS@ | |
55 | SIM_CFLAGS = @sim_cflags@ | |
56 | ||
57 | HDEFINES = @HDEFINES@ | |
58 | TDEFINES = | |
59 | ||
60 | CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) | |
61 | CSEARCH = -I. -I$(srcdir) -I$(srcroot)/include | |
62 | ALL_CFLAGS = $(CFLAGS) $(CONFIG_CFLAGS) $(CSEARCH) | |
63 | BUILD_CFLAGS = -g -O $(CSEARCH) | |
64 | ||
65 | AR = @AR@ | |
66 | AR_FLAGS = rc | |
67 | RANLIB = @RANLIB@ | |
68 | MAKEINFO = makeinfo | |
69 | ||
70 | .NOEXPORT: | |
71 | MAKEOVERRIDES= | |
72 | ||
73 | all: libcommon.a | |
74 | ||
75 | LIB_OBJS = callback.o targ-map.o | |
76 | ||
77 | # FIXME: Ideally, callback.o and friends live in a library outside of | |
78 | # both the gdb and simulator source trees (e.g. devo/remote. Not | |
79 | # devo/libremote because this directory would contain more than just | |
80 | # a library). | |
81 | ||
82 | libcommon.a: $(LIB_OBJS) | |
83 | rm -f libcommon.a | |
84 | $(AR) $(ARFLAGS) libcommon.a $(LIB_OBJS) | |
85 | $(RANLIB) libcommon.a | |
86 | ||
87 | callback.o: callback.c targ-vals.h $(srcroot)/include/callback.h | |
88 | ||
89 | targ-map.o: targ-map.c targ-vals.h | |
90 | ||
91 | # Generate TARG_VALS_H for newlib using devo and build tree. | |
92 | # This file is shipped with distributions so we build in the source dir. | |
93 | # This is built in srcdir so putting dependencies here is risky. | |
94 | # Use `make headers' to rebuild. | |
95 | headers: nltvals.def | |
96 | .PHONY: headers | |
97 | ||
98 | # Note: If gdb releases begin to contain target header files, generate | |
99 | # targ-vals.def at build time. | |
100 | ||
101 | nltvals.def: Makefile gentvals.sh | |
102 | rootme=`pwd` ; \ | |
103 | cd $(srcdir) ; \ | |
104 | rm -f nltvals.new ; \ | |
105 | echo '/* Newlib macro values needed by simulator. */' >nltvals.new ; \ | |
106 | echo '/* This file is machine generated by gentvalh.sh. */' >>nltvals.new ; \ | |
107 | $(SHELL) $(srcdir)/gentvals.sh errno $(srcroot)/newlib/libc/include \ | |
108 | "errno.h sys/errno.h" 'E[A-Z0-9]*' "$(CPP_FOR_TARGET)" >>nltvals.new ; \ | |
109 | $(SHELL) $(srcdir)/gentvals.sh signal $(srcroot)/newlib/libc/include \ | |
110 | "signal.h sys/signal.h" 'SIG[A-Z0-9]*' "$(CPP_FOR_TARGET)" >>nltvals.new ; \ | |
111 | $(SHELL) $(srcdir)/gentvals.sh open $(srcroot)/newlib/libc/include \ | |
112 | "fcntl.h sys/fcntl.h" 'O_[A-Z0-9]*' "$(CPP_FOR_TARGET)" >>nltvals.new ; \ | |
113 | $(srcroot)/move-if-change nltvals.new nltvals.def | |
114 | ||
115 | gentmap: Makefile gentmap.c | |
116 | $(CC_FOR_BUILD) $(srcdir)/gentmap.c -o gentmap $(BUILD_CFLAGS) | |
117 | ||
118 | targ-vals.h: Makefile gentmap | |
119 | rm -f targ-vals.h | |
120 | ./gentmap -h >targ-vals.h | |
121 | ||
122 | targ-map.c: Makefile gentmap | |
123 | rm -f targ-map.c | |
124 | ./gentmap -c >targ-map.c | |
125 | ||
126 | .c.o: | |
127 | $(CC) -c $< $(ALL_CFLAGS) | |
128 | ||
129 | check: | |
130 | ||
131 | info: | |
132 | clean-info: | |
133 | install-info: | |
134 | ||
135 | tags etags: TAGS | |
136 | ||
137 | TAGS: force | |
138 | etags *.c *.h | |
139 | ||
140 | clean: | |
141 | rm -f *.[oa] *~ core gentmap | |
142 | rm -f $(ALL) | |
143 | ||
144 | distclean mostlyclean maintainer-clean realclean: clean | |
145 | rm -f TAGS | |
146 | rm -f Makefile config.cache config.log config.status | |
147 | rm -f config.h stamp-h | |
148 | ||
149 | # Dummy target to force execution of dependent targets. | |
150 | force: | |
151 | ||
152 | # Copy the files into directories where they will be run. | |
153 | install: | |
154 | ||
155 | install-man: | |
156 | $(INSTALL_XFORM1) $(srcdir)/run.1 $(man1dir)/run.1 | |
157 | ||
158 | Makefile: Makefile.in config.status | |
159 | $(SHELL) ./config.status | |
160 | ||
161 | config.status: configure | |
162 | $(SHELL) ./config.status --recheck | |
163 | ||
164 | # We can't add dependencies to configure because it causes too much trouble | |
165 | # to end users if configure's timestamp is out of sync. | |
166 | .PHONY: run-autoconf | |
167 | run-autoconf: | |
168 | cd $(srcdir) && autoconf | |
169 | ||
170 | config.h: stamp-h ; @true | |
171 | stamp-h: config.in config.status | |
172 | CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status |