#
-# Makefile for binutils under openVMS/AXP
+# Makefile for binutils under openVMS (Alpha and Itanium)
#
# For use with gnu-make for vms
#
-# Created by Klaus Kämpf, kkaempf@progis.de
+# Created by Klaus Kaempf, kkaempf@rmi.de
#
+# Copyright (C) 2012-2023 Free Software Foundation, Inc.
#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+
+DEFS=/define=("OBJDUMP_PRIVATE_VECTORS=")
+OPT=/noopt/debug
+CFLAGS=$(OPT)/include=([],"../include",[-.bfd])$(DEFS)\
+ /name=(as_is,shortened)\
+ /prefix=(all,except=("getopt","optarg","optopt","optind","opterr"))\
+ /warns=(info=(ptrmismatch,shiftcount))
+
+LIBBFD = [-.bfd]libbfd.olb/lib
+LIBBFD_DEP = [-.bfd]libbfd.olb
+LIBIBERTY_DEP = [-.libiberty]libiberty.olb
+LIBIBERTY = [-.libiberty]libiberty.olb/lib
+OPCODES_DEP = [-.opcodes]libopcodes.olb
+OPCODES = [-.opcodes]libopcodes.olb/lib
+
+DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,rdcoff.obj,dwarf.obj,\
+ elfcomm.obj
+
+BULIBS = bucomm.obj,version.obj,filemode.obj
+
+ADDL_DEPS = $(BULIBS),$(LIBBFD_DEP),$(LIBIBERTY_DEP)
+ADDL_LIBS = $(BULIBS),$(LIBBFD),$(LIBIBERTY)
+
+SIZEOBJS = $(ADDL_DEPS),size.obj
-CC=gcc
+STRINGSOBJS = $(ADDL_DEPS),strings.obj
-ifeq ($(CC),gcc)
-CFLAGS=/include=([],[-.include],[-.bfd])$(DEFS)
-DEFS=/define=("unlink=remove")
-GCCLIBS=,GNU_CC:[000000]LIBGCC2/lib,GNU_CC:[000000]LIBGCCLIB/lib,sys$$disk:[-]vprintf.obj,sys$$library:vaxcrtl.olb/lib,GNU_CC:[000000]crt0.obj
-else
-CFLAGS=/noopt/debug/include=([],[-.include],[-.bfd])$(DEFS)
-DEFS=/define=(\
-"_bfd_generic_get_section_contents_in_window"="_bfd_generic_get_win_section_cont",\
-"_bfd_elf_section_from_bfd_section"="_bfd_elf_sec_from_bfd_sec")
-GCCLIBS=
-endif
+NMOBJS = $(ADDL_DEPS),nm.obj
-LIBBFD = [-.bfd]libbfd.olb
-LIBIBERTY = [-.libiberty]libiberty.olb
-LIBOPCODES = [-.opcodes]libopcodes.olb
+ADDR2LINEOBJS = $(ADDL_DEPS),addr2line.obj
-LIBS = $(LIBBFD) $(LIBOPCODES) $(LIBIBERTY)
+OBJDUMPOBJS = objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(ADDL_DEPS),$(OPCODES_DEP)
-DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,ieee.obj,prdbg.obj
+READELFOBJS = readelf.obj,dwarf.obj,unwind-ia64.obj,$(ADDL_DEPS)
-SIZEOBJS = bucomm.obj,version.obj,filemode.obj,size.obj
+all: config.h size.exe strings.exe objdump.exe nm.exe addr2line.exe
-OBJDUMPOBJS = bucomm.obj,version.obj,filemode.obj,objdump.obj
+size.exe: $(SIZEOBJS)
+ link/exe=$@ size.obj,$(ADDL_LIBS)
-NMOBJS = bucomm.obj,version.obj,filemode.obj,nm.obj
+strings.exe: $(STRINGSOBJS)
+ link/exe=$@ strings.obj,$(ADDL_LIBS)
-all: config.h size.exe objdump.exe nm.exe
+nm.exe: $(NMOBJS)
+ link/exe=$@ nm.obj,$(ADDL_LIBS)
-size.exe: $(SIZEOBJS) $(LIBS)
- link/exe=$@ $(SIZEOBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS)
+addr2line.exe: $(ADDR2LINEOBJS)
+ link/exe=$@ addr2line.obj,$(ADDL_LIBS)
-objdump.exe: $(DEBUG_OBJS) $(OBJDUMPOBJS) $(LIBS)
- link/exe=$@ $(OBJDUMPOBJS),$(DEBUG_OBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS)
+objdump.exe: $(OBJDUMPOBJS)
+ link/exe=$@ objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(ADDL_LIBS),$(OPCODES)
-nm.exe: $(NMOBJS) $(LIBS)
- link/exe=$@ $(NMOBJS),$(LIBBFD)/lib,$(LIBOPCODES)/lib,$(LIBIBERTY)/lib$(GCCLIBS)
+readelf.exe: $(READELFOBJS)
+ link/exe=$@ readelf.obj,dwarf.obj,unwind-ia64.obj,$(ADDL_LIBS)
-version.obj: version.c
- $(CC) $(CFLAGS)/define=(VERSION="""960408""") $<
+config.h:
+ $$ @configure
+ $(MAKE) -f makefile.vms "CC=$(CC)"
-objdump.obj: objdump.c
- $(CC) $(CFLAGS) $<
+clean:
+ $$ purge
+ $(RM) *.obj;
+ $(RM) *.exe;
-config.h: config.h-vms
- $(CP) $< $@
+distclean: clean
+ $(RM) config.h;
+ $(RM) makefile.vms;