diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-02-05 21:17:52 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-02-05 21:17:52 +0000 |
commit | e0bf1022ddc4d5697106c67a0a6f4088fb6531aa (patch) | |
tree | 1f9427e3aee6b565caac17784eabdece6a76a329 /opcodes/Makefile.in | |
parent | 44f795f7feef198729a978ff84c4c2dc9efbc1b3 (diff) | |
download | gdb-e0bf1022ddc4d5697106c67a0a6f4088fb6531aa.zip gdb-e0bf1022ddc4d5697106c67a0a6f4088fb6531aa.tar.gz gdb-e0bf1022ddc4d5697106c67a0a6f4088fb6531aa.tar.bz2 |
Support for building as a shared library, based on patches from
Alan Modra <alan@spri.levels.unisa.edu.au>:
* configure.in: Add AC_ARG_ENABLE for shared and commonbfdlib.
New substitutions: ALLLIBS, PICFLAG, SHLIB, SHLIB_CC,
SHLIB_CFLAGS, COMMON_SHLIB, SHLINK.
* configure: Rebuild.
* Makefile.in (ALLLIBS): New variable.
(PICFLAG, SHLIB, SHLIB_CC, SHLIB_CFLAGS): New variables.
(COMMON_SHLIB, SHLINK): New variables.
(.c.o): If PICFLAG is set, compile twice, once PIC, once normal.
(STAGESTUFF): Remove variable.
(all): Depend upon $(ALLLIBS) rather than $(TARGETLIB).
(stamp-piclist, piclist): New targets.
($(SHLIB), $(SHLINK)): New targets.
($(OFILES)): Depend upon stamp-picdir.
(disassemble.o): Build twice if PICFLAG is set.
(MOSTLYCLEAN): Add pic/*.o.
(clean): Remove $(SHLIB), $(SHLINK), piclist, and stamp-piclist.
(distclean): Remove pic and stamp-picdir.
(install): Install shared libraries.
(stamp-picdir): New target.
Diffstat (limited to 'opcodes/Makefile.in')
-rw-r--r-- | opcodes/Makefile.in | 89 |
1 files changed, 74 insertions, 15 deletions
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index e00011c..9972393 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -51,16 +51,23 @@ AR = @AR@ AR_FLAGS = rc CC = @CC@ CFLAGS = @CFLAGS@ -BISON = bison MAKEINFO = makeinfo RANLIB = @RANLIB@ +ALLLIBS = @ALLLIBS@ + +PICFLAG = @PICFLAG@ +SHLIB = @SHLIB@ +SHLIB_CC = @SHLIB_CC@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +COMMON_SHLIB = @COMMON_SHLIB@ +SHLINK = @SHLINK@ + INCDIR = $(srcdir)/../include BFDDIR = $(srcdir)/../bfd CSEARCH = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) DEP = mkdep - TARGETLIB = libopcodes.a # To circumvent a Sun make VPATH bug, each file listed here @@ -87,21 +94,20 @@ FLAGS_TO_PASS = \ "MAKEINFO=$(MAKEINFO)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ - "BISON=$(BISON)" + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" ALL_CFLAGS = $(CSEARCH) @HDEFINES@ $(CFLAGS) .c.o: + if [ -n "$(PICFLAG)" ]; then \ + $(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \ + else true; fi $(CC) -c $(ALL_CFLAGS) $< # C source files that correspond to .o's. CFILES = i386-dis.c z8k-dis.c m68k-dis.c mips-dis.c ns32k-dis.c ppc-dis.c -STAGESTUFF = $(TARGETLIB) $(OFILES) - -all: $(TARGETLIB) - +all: $(ALLLIBS) .NOEXPORT: @@ -120,7 +126,43 @@ $(TARGETLIB): $(OFILES) $(AR) $(AR_FLAGS) $(TARGETLIB) $(OFILES) $(RANLIB) $(TARGETLIB) +stamp-piclist: Makefile + rm -f tpiclist + if [ -n "$(PICFLAG)" ]; then \ + echo $(OFILES) | sed -e 's,\([^ ][^ ]*\),pic/\1,g' > tpiclist; \ + else \ + echo $(OFILES) > tpiclist; \ + fi + $(srcdir)/../move-if-change tpiclist piclist + touch stamp-piclist + +piclist: stamp-piclist ; @true + +$(SHLIB): stamp-picdir $(OFILES) piclist + rm -f $(SHLIB) + if [ "$(COMMON_SHLIB)" != "yes" ]; then \ + $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist`; \ + else \ + lobjs=`cat ../libiberty/required-list ../libiberty/needed-list`; \ + if [ -n "$(PICFLAG)" ]; then \ + lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),pic/\1,g'`; \ + fi; \ + lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),../libiberty/\1,g'`; \ + $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) \ + `sed -e 's,\([^ ][^ ]*\),../bfd/\1,g' ../bfd/piclist` \ + `cat piclist` $$lobjs; \ + fi + +$(SHLINK): $(SHLIB) + rm -f $(SHLINK) + ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $(SHLINK) + +$(OFILES): stamp-picdir + disassemble.o: disassemble.c $(INCDIR)/dis-asm.h + if [ -n "$(PICFLAG)" ]; then \ + $(CC) -c @archdefs@ $(PICFLAG) $(ALL_CFLAGS) $(srcdir)/disassemble.c -o pic/disassemble.o; \ + else true; fi $(CC) -c @archdefs@ $(ALL_CFLAGS) $(srcdir)/disassemble.c a29k-dis.o: a29k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/a29k.h @@ -152,14 +194,15 @@ tags etags: TAGS TAGS: force etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c -MOSTLYCLEAN = *.o core *.E *.p *.ip config.log +MOSTLYCLEAN = *.o core *.E *.p *.ip config.log pic/*.o mostlyclean: rm -rf $(MOSTLYCLEAN) clean: - rm -f *.a $(MOSTLYCLEAN) + rm -f *.a $(MOSTLYCLEAN) $(SHLIB) $(SHLINK) piclist stamp-piclist distclean: clean - rm -rf Makefile config.status TAGS config.cache config.h -clobber realclean: distclean + rm -rf Makefile config.status TAGS config.cache config.h stamp-h \ + pic stamp-picdir +clobber realclean maintainer-clean: distclean # Mark everything as depending on config.status, since the timestamp on # sysdep.h might actually move backwards if we reconfig and relink it @@ -184,9 +227,20 @@ roll: # force: -install: - $(INSTALL_DATA) $(TARGETLIB) $(libdir)/libopcodes.a - $(RANLIB) $(libdir)/libopcodes.a +install: $(ALLLIBS) + for f in $(ALLLIBS); do \ + bf=`echo $$f | sed -e 's,^\.\./bfd/,,'`; \ + rm -f $(libdir)/$$bf; \ + if [ "$$f" = "$(SHLINK)" ]; then \ + ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $(libdir)/$$bf; \ + elif [ "$$f" = "$(SHLIB)" ]; then \ + $(INSTALL_PROGRAM) $$f $(libdir)/$$bf; \ + else \ + $(INSTALL_DATA) $$f $(libdir)/$$bf; \ + $(RANLIB) $(libdir)/$$bf; \ + chmod a-x $(libdir)/$$bf; \ + fi; \ + done Makefile: Makefile.in config.status CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status @@ -201,6 +255,11 @@ config.status : configure $(srcdir)/../bfd/configure.host $(srcdir)/../bfd/confi dep: $(CFILES) mkdep $(CFLAGS) $? +stamp-picdir: + if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \ + mkdir pic; \ + else true; fi + touch stamp-picdir # What appears below is generated by a hacked mkdep using gcc -MM. |