Now handles multiple hosts and targets.
[binutils-gdb.git] / binutils / Makefile.in
1 ### Makefile for GNU binary-file utilities
2
3 #$Id$
4
5 srcdir = .
6 destdir = /usr/local
7
8 version=`$(srcdir)/../gcc$(subdir)/gcc -dumpversion`
9 prefix = $(destdir)
10 bindir = $(prefix)/bin
11 libdir = $(prefix)/lib
12 libsubdir = $(libdir)/gcc/$(target)/$(version)
13
14 INSTALL = install -c
15 INSTALL_PROGRAM = $(INSTALL)
16 INSTALL_FILE = $(INSTALL)
17
18 ## Configuration options
19 # These should be all you need set before compiling
20
21 #CC=gcc -Wall
22 # these two should be the same program
23 AR_PROG=ar
24 RANLIB_PROG=ranlib
25
26 # copy and strip should be the same program
27 COPY_PROG=copy
28 STRIP_PROG=strip
29
30 # These should all be the same program too.
31 SIZE_PROG=size
32 NM_PROG=nm
33 OBJDUMP_PROG=objdump
34
35 PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG)
36
37 #CC = gcc -Wall
38 #CC=gcc
39 BASEDIR = $(srcdir)/..
40 # Let rich do this for now:
41 LIBDIR = $(srcdir)/../bfd$(subdir)
42
43 #__dgux__#DEFINES=-DHOST_SYS=DGUX_SYS
44
45 #__sun3__#DEFINES=-DHOST_SYS=SUN3_SYS
46 #__sun3__#LDFLAGS= -Bstatic
47
48 #__sun4__#DEFINES=-DHOST_SYS=SUN4_SYS
49 #__sun4__#LDFLAGS= -Bstatic
50
51 #__sun386i__#LDFLAGS = -Bstatic
52
53 #__rs6000__#DEFINES=-Daix
54 #__rs6000__#ALLOCA = alloca.o
55
56 #__i386v__#ALLOCA = alloca.o
57 #__i386v__#DEFINES=-DUSG
58
59
60 #### host and target dependant Makefile fragments come in here.
61 ###
62
63 INCDIR = $(BASEDIR)/include-cygnus
64
65 CFLAGS = -g -I$(INCDIR) $(DEFINES) $(CDEFINES)
66
67
68 bindir=$(BASEDIR)/bin
69
70 DISASMS = m68k-pinsn.o i960-pinsn.o sparc-pinsn.o
71 #\f
72 ## Random definitions
73 # Hopefully all these may be flushed once we get configuration down pat.
74
75 # alloca only needed for systems which don't have it and when cc != gcc.
76 # ALLOCA = alloca.o
77
78 # nm tries to malloc enough space for the string table. The old GNU malloc
79 # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
80 # fail unnecessarily. I've also seen some Unix malloc's fail, even when
81 # there is enough memory. So use the new GNU malloc.
82 # MALLOC = gmalloc.o
83
84 # Use the GNU getopt unless you have problems with it.
85 # The IRIS version could probably benefit from being assembled with
86 # libmalloc rather than the ordinary malloc.
87 GNU_GETOPT = getopt.o $(ALLOCA)
88 GNU_GETOPT_LONG = getopt1.o $(GNU_GETOPT)
89
90
91
92
93 # Code shared by all the binutils.
94 BULIBS = bucomm.o version.o filemode.o
95
96 ADDL_LIBS = $(GNU_GETOPT_LONG) $(MALLOC) $(BULIBS)
97
98 BFD = $(LIBDIR)/libbfd.a
99 #\f
100 ## The rules
101
102 all: $(ADDL_LIBS) $(PROGS)
103
104
105 #$(BFD):$(LIBDIR)/../common/*.c
106 # (cd $(LIBDIR); make)
107
108 $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
109 $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(BFD)
110
111 $(COPY_PROG): $(ADDL_LIBS) copy.o $(BFD)
112 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o $(ADDL_LIBS) $(BFD)
113
114 $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
115 $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(MALLOC) $(ADDL_LIBS) $(BFD)
116
117 $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD)
118 $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(BFD)
119
120 $(AR_PROG): $(ADDL_LIBS) ar.o $(BFD)
121 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o $(MALLOC) $(ADDL_LIBS) $(BFD)
122
123 $(RANLIB_PROG): $(AR_PROG)
124 -rm -f $(RANLIB_PROG)
125 -ln $(AR_PROG) $(RANLIB_PROG)
126
127 $(STRIP_PROG): $(COPY_PROG)
128 -rm -f $(STRIP_PROG)
129 -ln $(COPY_PROG) $(STRIP_PROG)
130
131 clean:
132 -rm -f *.o *~ \#* core $(PROGS) TAGS
133
134 etags tags: TAGS
135
136 TAGS: .force
137 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
138
139 realclean: clean
140 -rm -f $(PROGS) TAGS
141
142 install: $(PROGS)
143 for i in $(PROGS) ; do \
144 $(INSTALL_PROGRAM) $$i $(destdir)/bin/$$i ; \
145 done
146
147 bucomm.o: bucomm.c
148 version.o: version.c
149 size.o: size.c
150 copy.o: copy.c
151 objdump.o: objdump.c
152 m68k-pinsn.o: m68k-pinsn.c
153 m68k-pinsn.o: ./m68k-opcode.h
154 i960-pinsn.o: i960-pinsn.c
155 sparc-pinsn.o: sparc-pinsn.c
156 sparc-pinsn.o: ./sparc-opcode.h
157 nm.o: nm.c
158 ar.o: ar.c
159 getopt.o:getopt.c
160 getopt1.o:getopt1.c
161 filemode.o:filemode.c
162 #-----------------------------------------------------------------------------
163 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
164 #
165 # 'VERSION' file must be present and contain a string of the form "x.y"
166 #-----------------------------------------------------------------------------
167
168 ver960.c: FORCE
169 rm -f ver960.c
170 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
171
172
173 # Dummy target to force execution of dependent targets.
174 #
175 .force:
176 FORCE:
177
178 # Target to uncomment host-specific lines in this makefile. Such lines must
179 # have the following string beginning in column 1: #__<hostname>__#
180 # Original Makefile is backed up as 'Makefile.old'.
181 #
182 # Invoke with: make make HOST=xxx
183 #
184 make:
185 -@if test $(HOST)x = x ; then \
186 echo '\aSpecify "make make HOST=???"'; \
187 exit 1; \
188 fi ; \
189 grep -s "^#The next line was generated by 'make make'" Makefile; \
190 if test $$? = 0 ; then \
191 echo "\aMakefile has already been processed with 'make make'";\
192 exit 1; \
193 fi ; \
194 mv -f Makefile Makefile.old; \
195 echo "#The next line was generated by 'make make'" >Makefile ; \
196 echo "HOST=$(HOST)" >>Makefile ; \
197 echo >>Makefile ; \
198 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
199
200 #\f
201
202 Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
203 (cd $(srcdir) ; \
204 ./configure +norecurse \
205 +destdir=$(destdir) \
206 `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \
207 $(host) +target=$(target))
208
209 ### Local Variables: ***
210 ### mode:fundamental ***
211 ### page-delimiter: "^#\f" ***
212 ### End: ***
213 ### end of file