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