summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/libiberty/Makefile.in
blob: bb73e94b91c52362e8c7de69141c84fd3761472f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#
# Makefile
#   Copyright (C) 1990, 1991, 1992, 1995, 1996 Free Software Foundation
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# Libiberty is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with libiberty; see the file COPYING.LIB.  If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

# This file was written, and is maintained by K. Richard Pixley
# <rich@cygnus.com>.

#
# Makefile for libiberty directory
#

srcdir = .

prefix = /usr/local

exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib

datadir = $(prefix)/share

mandir = $(prefix)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
man9dir = $(mandir)/man9
infodir = $(prefix)/info
includedir = $(prefix)/include

SHELL = /bin/sh

# Multilib support variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true

INSTALL = install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

AR = ar
AR_FLAGS = rc

ERRORS_CC = $(CC)
CC = cc
CFLAGS = -g
LIBCFLAGS = $(CFLAGS)
MAKEINFO = makeinfo
RANLIB = ranlib

PICFLAG =

MAKEOVERRIDES =

TARGETLIB = libiberty.a

CONFIG_H = lconfig.h
NEEDED_LIST = lneeded-list

# HOST_OFILES contains the list of objects that should be in the
# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
# A configuration may override this with a fixed list a object files
# names (hard to maintain), or some other way to generate a list.
HOST_OFILES=`cat needed-list`

# Extra targets that the top-level target depends on.
# Specifically, what needs to be made before HOST_OFILES can be used.
# Can be empty if HOST_OFILES is just a list of file names.
DO_ALSO = needed-list

# A configuration can specify extra .o files that should be included,
# even if they are in libc. (Perhaps the libc version is buggy.)
EXTRA_OFILES = 

# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
	"AR=$(AR)" \
	"AR_FLAGS=$(AR_FLAGS)" \
	"CC=$(CC)" \
	"CFLAGS=$(CFLAGS)" \
	"LIBCFLAGS=$(LIBCFLAGS)" \
	"EXTRA_OFILES=$(EXTRA_OFILES)" \
	"HDEFINES=$(HDEFINES)" \
	"LDFLAGS=$(LDFLAGS)" \
	"LOADLIBES=$(LOADLIBES)" \
	"PICFLAG=$(PICFLAG)" \
	"RANLIB=$(RANLIB)" \
	"SHELL=$(SHELL)"

all: stamp-picdir $(TARGETLIB) required-list
	@if [ "$(RULE1)" != "not-used" ]; then \
	  $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
	else true; \
	fi

.PHONY: check installcheck
check installcheck:


#### Host, target, and site specific Makefile fragments come in here.
###

INCDIR=$(srcdir)/$(MULTISRCTOP)../include

COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
.c.o:
	test -z "$(PICFLAG)" || \
	  $(COMPILE.c) $(PICFLAG) $< -o pic/$@
	$(COMPILE.c) $<

# The default target just invokes make recursively.
# However, the automatic configuration (in config/mh_default).
# first causes it to figure out the objects missing in libc.
info install-info clean-info dvi:

# Include files that are in this directory.
HFILES =

# NOTE: If you add new files to the library, add them to this list
# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
CFILES = alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \
	 choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \
	 getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
         floatformat.c hex.c index.c insque.c \
	 memchr.c memcmp.c memcpy.c memmove.c memset.c \
         obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
	 strcasecmp.c strncasecmp.c \
         strchr.c strdup.c strerror.c strrchr.c strsignal.c \
         strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
	 vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
	 xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
# These are always included in the library.
REQUIRED_OFILES = argv.o basename.o choose-temp.o concat.o cplus-dem.o \
  fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \
  floatformat.o obstack.o spaces.o strerror.o strsignal.o \
  xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o

# Do we want/need any config overrides?
#	 

STAGESTUFF = $(TARGETLIB) *.o

INSTALL_DEST = libdir
install: install_to_$(INSTALL_DEST)

install_to_libdir: all
	$(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
	( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
	mv -f $(libdir)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install

install_to_tooldir: all
	$(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
	( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
	mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install

# The default configuration adds to libiberty all those functions that are
# missing in libc.  More precisely, it includes whatever $(CC) fails to find.
# Then a sed+awk combination translates the ld error messages into
# a list of .o files.

needed-list: stamp-picdir $(NEEDED_LIST)
	cp $(NEEDED_LIST) needed-list

lneeded-list: $(EXTRA_OFILES) needed.awk errors
	rm -f lneeded-list
	f=""; \
	for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
	  case " $$f " in \
	    *" $$i "*) ;; \
	    *) f="$$f $$i" ;; \
	  esac ; \
	done ; \
	case $$f in \
	    *alloca.o*) f="$$f xmalloc.o" ;; \
	esac ; \
	echo $$f >>lneeded-list

# Generate an awk script that looks for functions in functions.def

needed.awk: $(srcdir)/functions.def Makefile
	echo "# !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT!" >needed.awk
	grep '^DEF(' < $(srcdir)/functions.def \
	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
	    >>needed.awk

config.h: $(CONFIG_H)
	cp $(CONFIG_H) config.h

lconfig.h: needed2.awk errors
	echo "/* !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT! */" >lconfig.h
	awk -f needed2.awk <errors >>lconfig.h

# Generate an awk script that looks for variables in functions.def

needed2.awk: $(srcdir)/functions.def Makefile
	echo "# !Automatically generated from $(srcdir)/functions.def"\
	  "- DO NOT EDIT!" >needed2.awk
	grep '^DEFVAR(' < $(srcdir)/functions.def \
	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk
	grep '^DEFFUNC(' < $(srcdir)/functions.def \
	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk

dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
	$(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null

errors: dummy.o $(EXTRA_OFILES)
	-($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true

# required-list is used when building a shared bfd/opcodes/libiberty library.
required-list: Makefile
	echo $(REQUIRED_OFILES) > required-list

$(HOST_OFILES) $(REQUIRED_OFILES) : config.h

RULE1 = $(TARGETLIB)
$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
	@$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
		"HOST_OFILES=$(HOST_OFILES)"

# Rule invoked by recursive make in $(RULE1).
RULE2 = not-used
$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
	rm -rf $(TARGETLIB)
	$(AR) $(AR_FLAGS) $(TARGETLIB) \
	  $(REQUIRED_OFILES) $(HOST_OFILES)
	$(RANLIB) $(TARGETLIB)

stamp-picdir:
	if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
	  mkdir pic; \
	else true; fi
	touch stamp-picdir

.always.:
# Do nothing.

.PHONY: all etags tags ls clean stage1 stage2 .always.

etags tags: TAGS

TAGS: $(CFILES) $(HFILES)
	etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`

# The standalone demangler (c++filt) has been moved to binutils.
demangle:
	@echo "The standalone demangler, now named c++filt, is now"
	@echo "a part of binutils."
	@false

ls:
	@echo Makefile $(HFILES) $(CFILES)

# Need to deal with profiled libraries, too.

mostlyclean:
	rm -rf *.o pic core errs \#* *.E a.out
	rm -f needed.awk needed2.awk errors dummy needed-list config.h
	rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
	@$(MULTICLEAN) multi-clean DO=mostlyclean
clean: mostlyclean
	rm -f *.a required-list
	@$(MULTICLEAN) multi-clean DO=clean
distclean: clean
	rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS multilib.out
	@$(MULTICLEAN) multi-clean DO=distclean
maintainer-clean realclean: distclean

force:

Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
	$(SHELL) ./config.status

argv.o: $(INCDIR)/libiberty.h
basename.o: $(INCDIR)/libiberty.h
concat.o: $(INCDIR)/libiberty.h
cplus-dem.o: $(INCDIR)/demangle.h
fdmatch.o: $(INCDIR)/libiberty.h
fnmatch.o: $(INCDIR)/fnmatch.h
getopt.o: $(INCDIR)/getopt.h
getopt1.o: $(INCDIR)/getopt.h
getruntime.o: $(INCDIR)/libiberty.h
hex.o: $(INCDIR)/libiberty.h
floatformat.o: $(INCDIR)/floatformat.h
obstack.o: $(INCDIR)/obstack.h
spaces.o: $(INCDIR)/libiberty.h
strerror.o: $(INCDIR)/libiberty.h
strsignal.o: $(INCDIR)/libiberty.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xmalloc.o: $(INCDIR)/libiberty.h
xstrdup.o: $(INCDIR)/libiberty.h
xstrerror.o: $(INCDIR)/libiberty.h