--- binutils/Makefile 2018/04/24 16:07:03 1.1.1.3 +++ binutils/Makefile 2018/04/24 16:07:06 1.1.1.4 @@ -25,7 +25,8 @@ GNUCC = gcc -O CFLAGS = -g # Don't add robotussin; it won't compile on BSD or GNU systems. # objdump also won't compile on most systems (trouble with N_DATADDR). -PROGS = gprof ld size nm strip ar ranlib +PROGS = $(archpfx)gprof $(archpfx)ld $(archpfx)size \ + $(archpfx)nm $(archpfx)strip $(archpfx)ar $(archpfx)ranlib # for USG systems using COFF_ENCAPSULATE # also, you will want to make the target libc.a (but it takes a long time) @@ -33,10 +34,13 @@ PROGS = gprof ld size nm strip ar ranlib # after you install it, since `ranlib' will try to run it from here. #CFLAGS = -g -DUSG -DCOFF_ENCAPSULATE -DPORTAR -DNON_NATIVE #PROGS = ld size nm strip ar robotussin objdump ranlib gprof +# On ALTOS systems, add -DALTOS to CFLAGS. + #it's better to move a copy of alloca into your libc than to risk getting some #incompatiable functions from -lPW (like index()), but if you #want to be lazy, uncomment this line #LIBS = -lPW + # For HP-UX systems # Don't add robotussin; use hpxt instead. # Note that you should leave a copy of `ar' in this directory @@ -46,51 +50,55 @@ PROGS = gprof ld size nm strip ar ranlib #LIBS = alloca.o # Use the GNU getopt unless you have problems with it. -GNU_GETOPT = getopt.o +GNU_GETOPT = $(archpfx)getopt.o +GNU_GETOPT_LONG = $(archpfx)getopt.o $(archpfx)getopt1.o all: $(PROGS) -ld: ld.o +ld: $(archpfx)ld.o # LIBS is used here since ld needs to use alloca. # Alternatively, compile it with GNU C--then the compiler handles alloca. - $(CC) -o ld ld.o $(LIBS) + $(CC) -o $(archpfx)ld $(archpfx)ld.o $(LIBS) + +$(archpfx)size: $(archpfx)size.o + $(CC) -o $(archpfx)size $(archpfx)size.o -size: size.o - $(CC) -o size size.o +$(archpfx)nm: $(archpfx)nm.o $(GNU_GETOPT_LONG) + $(CC) -o $(archpfx)nm $(archpfx)nm.o $(LIBS) $(GNU_GETOPT_LONG) -nm: nm.o $(GNU_GETOPT) - $(CC) -o nm nm.o $(LIBS) $(GNU_GETOPT) +$(archpfx)strip: $(archpfx)strip.o $(GNU_GETOPT) + $(CC) -o $(archpfx)strip $(archpfx)strip.o $(LIBS) $(GNU_GETOPT_LONG) -strip: strip.o $(GNU_GETOPT) - $(CC) -o strip strip.o $(GNU_GETOPT) +$(archpfx)ar: $(archpfx)ar.o + $(CC) -o $(archpfx)ar $(archpfx)ar.o -ar: ar.o - $(CC) -o ar ar.o +$(archpfx)gprof: $(archpfx)gprof.o $(GNU_GETOPT_LONG) + $(GNUCC) -o $(archpfx)gprof $(archpfx)gprof.o $(GNU_GETOPT_LONG) +$(archpfx)gprof.o: gprof.c gmon.h + $(GNUCC) -c $(CFLAGS) gprof.c $(OUTPUT_OPTION) -gprof: gprof.o $(GNU_GETOPT) - $(GNUCC) -o gprof gprof.o $(GNU_GETOPT) -gprof.o: gprof.c gmon.h - $(GNUCC) -c $(CFLAGS) gprof.c +$(archpfx)ranlib: $(archpfx)ranlib.o + $(CC) -o $(archpfx)ranlib $(archpfx)ranlib.o $(GNU_GETOPT_LONG) +$(archpfx)ranlib.o: ranlib.c + $(CC) -c $(CFLAGS) -DAR_PROG=\"$(bindir)/ar\" ranlib.c $(OUTPUT_OPTION) -ranlib: ranlib.o - $(CC) -o ranlib ranlib.o -ranlib.o: ranlib.c - $(CC) -c -g -DAR_PROG=\"`pwd`/ar\" ranlib.c +$(archpfx)objdump: $(archpfx)objdump.o + $(CC) -o $(archpfx)objdump $(archpfx)objdump.o $(GNU_GETOPT_LONG) # Robotussin is NOT part of `all'. -robotussin: robotussin.o - $(CC) -o robotussin robotussin.o +$(archpfx)robotussin: $(archpfx)robotussin.o + $(CC) -o $(archpfx)robotussin $(archpfx)robotussin.o -libc.a: robotussin libconvert ar +libc.a: $(archpfx)robotussin libconvert $(archpfx)ar libconvert /lib/libc.a libc.a # usg-gnulib is the file gcc makes using the usg compiler -gnulib: robotussin libconvert usg-gnulib ar +gnulib: $(archpfx)robotussin libconvert usg-gnulib $(archpfx)ar libconvert usg-gnulib gnulib clean: -rm -f *.o core - -rm -f gprof ar nm size strip ld robotussin objdump ranlib + -rm -f $(PROGS) dist: -rm -rf binutils @@ -102,3 +110,11 @@ dist: tar cohf binutils.tar binutils compress < binutils.tar > binutils.tar.Z rm -rf binutils + +.PHONY: install +install: $(PROGS) + for file in $(PROGS); do \ + cp $$file $(bindir)/$${file}.new \ + mv $(bindir)/$${file}.new $(bindir)/$file \ + done +