Now uses getopt from ../getopt.
[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
64
65 CFLAGS = -g -I$(srcdir)/../include-cygnus -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 = $(srcdir)/../getopt$(subdir)/libgetopt.a
88 GNU_GETOPT_LONG = $(srcdir)/../getopt$(subdir)/libgetopt.a
89
90 # Code shared by all the binutils.
91 BULIBS = bucomm.o version.o filemode.o
92
93 ADDL_LIBS = $(GNU_GETOPT_LONG) $(MALLOC) $(BULIBS)
94
95 BFD = $(LIBDIR)/libbfd.a
96 #\f
97 ## The rules
98
99 all: $(ADDL_LIBS) $(PROGS)
100
101
102 #$(BFD):$(LIBDIR)/../common/*.c
103 # (cd $(LIBDIR); make)
104
105 $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
106 $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(BFD)
107
108 $(COPY_PROG): $(ADDL_LIBS) copy.o $(BFD)
109 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o $(ADDL_LIBS) $(BFD)
110
111 $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
112 $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(MALLOC) $(ADDL_LIBS) $(BFD)
113
114 $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD)
115 $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(BFD)
116
117 $(AR_PROG): $(ADDL_LIBS) ar.o $(BFD)
118 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o $(MALLOC) $(ADDL_LIBS) $(BFD)
119
120 $(RANLIB_PROG): $(AR_PROG)
121 -rm -f $(RANLIB_PROG)
122 -ln $(AR_PROG) $(RANLIB_PROG)
123
124 $(STRIP_PROG): $(COPY_PROG)
125 -rm -f $(STRIP_PROG)
126 -ln $(COPY_PROG) $(STRIP_PROG)
127
128 clean:
129 -rm -f *.o *~ \#* core $(PROGS) TAGS
130
131 etags tags: TAGS
132
133 TAGS: .force
134 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
135
136 realclean: clean
137 -rm -f $(PROGS) TAGS
138
139 install: $(PROGS)
140 for i in $(PROGS) ; do \
141 $(INSTALL_PROGRAM) $$i $(destdir)/bin/$$i ; \
142 done
143
144 bucomm.o: bucomm.c
145 version.o: version.c
146 size.o: size.c
147 copy.o: copy.c
148 objdump.o: objdump.c
149 m68k-pinsn.o: m68k-pinsn.c
150 m68k-pinsn.o: ./m68k-opcode.h
151 i960-pinsn.o: i960-pinsn.c
152 sparc-pinsn.o: sparc-pinsn.c
153 sparc-pinsn.o: ./sparc-opcode.h
154 nm.o: nm.c
155 ar.o: ar.c
156 getopt.o:getopt.c
157 getopt1.o:getopt1.c
158 filemode.o:filemode.c
159 #-----------------------------------------------------------------------------
160 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
161 #
162 # 'VERSION' file must be present and contain a string of the form "x.y"
163 #-----------------------------------------------------------------------------
164
165 ver960.c: FORCE
166 rm -f ver960.c
167 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
168
169
170 # Dummy target to force execution of dependent targets.
171 #
172 .force:
173 FORCE:
174
175 # Target to uncomment host-specific lines in this makefile. Such lines must
176 # have the following string beginning in column 1: #__<hostname>__#
177 # Original Makefile is backed up as 'Makefile.old'.
178 #
179 # Invoke with: make make HOST=xxx
180 #
181 make:
182 -@if test $(HOST)x = x ; then \
183 echo '\aSpecify "make make HOST=???"'; \
184 exit 1; \
185 fi ; \
186 grep -s "^#The next line was generated by 'make make'" Makefile; \
187 if test $$? = 0 ; then \
188 echo "\aMakefile has already been processed with 'make make'";\
189 exit 1; \
190 fi ; \
191 mv -f Makefile Makefile.old; \
192 echo "#The next line was generated by 'make make'" >Makefile ; \
193 echo "HOST=$(HOST)" >>Makefile ; \
194 echo >>Makefile ; \
195 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
196
197 #\f
198
199 Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
200 (cd $(srcdir) ; \
201 ./configure +norecurse \
202 +destdir=$(destdir) \
203 `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \
204 $(host) +target=$(target))
205
206 ### Local Variables: ***
207 ### mode:fundamental ***
208 ### page-delimiter: "^#\f" ***
209 ### End: ***
210 ### end of file