shithub: scc

Download patch

ref: c809e59d972aead305d59b23e4d1d156c1ebd2a6
parent: 6f15bbc2f063296165f0a3ae742c671a828a0297
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jan 8 09:49:00 EST 2019

[objdump] Move objdump to src/cmd

--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@
 PROJECTDIR = ..
 include $(PROJECTDIR)/scripts/rules.mk
 
-TOOLS = cc1 cc2 ld as objdump cmd
+TOOLS = cc1 cc2 ld as cmd
 LIBS  = libscc libc libcrt libmach
 DIRS  = $(TOOLS) $(LIBS)
 
--- a/src/cmd/Makefile
+++ b/src/cmd/Makefile
@@ -8,6 +8,7 @@
          $(BINDIR)/size \
          $(BINDIR)/ar \
          $(BINDIR)/ranlib \
+         $(BINDIR)/objdump \
 
 LIBS   = -lmach
 
@@ -26,6 +27,9 @@
 
 $(BINDIR)/ranlib: ranlib.o
 	$(CC) $(SCC_LDFLAGS) ranlib.o -lmach -o $@
+
+$(BINDIR)/objdump: objdump.o
+	$(CC) $(SCC_LDFLAGS) objdump.o -lmach -o $@
 
 $(BINDIR)/ar: ar.o ar-$(DRIVER).o
 	$(CC) $(SCC_LDFLAGS) ar.o ar-$(DRIVER).o -o $@
--- /dev/null
+++ b/src/cmd/objdump.c
@@ -1,0 +1,62 @@
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/arg.h>
+#include <scc/mach.h>
+
+char *argv0;
+static char *filename;
+static int status;
+
+static void
+error(char *fmt, ...)
+{
+	va_list va;
+
+	va_start(va, fmt);
+	fprintf(stderr, "objdump: %s: ", filename);
+	vfprintf(stderr, fmt, va);
+	putc('\n', stderr);
+	va_end(va);
+
+	status = EXIT_FAILURE;
+}
+
+static void
+dump(char *fname)
+{
+}
+
+static void
+usage(void)
+{
+	fputs("usage: objdump file ...\n", stderr);
+	exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+	ARGBEGIN {
+	default:
+		usage();
+	} ARGEND
+
+	if (argc == 0)
+		dump("a.out");
+	else while (*argv) {
+		dump(*argv++);
+	}
+
+	if (fclose(stdout) == EOF) {
+		fprintf(stderr,
+		        "objdump: writing output: %s\n",
+		        strerror(errno));
+		return EXIT_FAILURE;
+	}
+
+	return status;
+}
--- a/src/objdump/Makefile
+++ /dev/null
@@ -1,16 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-OBJS = objdump.o 
-TARGET = $(BINDIR)/objdump
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS) $(LIBDIR)/libmach.a
-	$(CC) $(SCC_LDFLAGS) $(OBJS) -lscc -o $@
-
-dep: inc-dep
-
-include deps.mk
--- a/src/objdump/deps.mk
+++ /dev/null
@@ -1,3 +1,0 @@
-#deps
-objdump.o: $(INCDIR)/scc/scc/arg.h
-objdump.o: $(INCDIR)/scc/scc/mach.h
--- a/src/objdump/objdump.c
+++ /dev/null
@@ -1,62 +1,0 @@
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <scc/arg.h>
-#include <scc/mach.h>
-
-char *argv0;
-static char *filename;
-static int status;
-
-static void
-error(char *fmt, ...)
-{
-	va_list va;
-
-	va_start(va, fmt);
-	fprintf(stderr, "objdump: %s: ", filename);
-	vfprintf(stderr, fmt, va);
-	putc('\n', stderr);
-	va_end(va);
-
-	status = EXIT_FAILURE;
-}
-
-static void
-dump(char *fname)
-{
-}
-
-static void
-usage(void)
-{
-	fputs("usage: objdump file ...\n", stderr);
-	exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
-	ARGBEGIN {
-	default:
-		usage();
-	} ARGEND
-
-	if (argc == 0)
-		dump("a.out");
-	else while (*argv) {
-		dump(*argv++);
-	}
-
-	if (fclose(stdout) == EOF) {
-		fprintf(stderr,
-		        "objdump: writing output: %s\n",
-		        strerror(errno));
-		return EXIT_FAILURE;
-	}
-
-	return status;
-}