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