shithub: scc

Download patch

ref: 620493c9bdc92f1d4309f1b6bbf9c23f2000aecb
parent: 91969afe96ea1d251bb1bf3f4afd58049350f890
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Nov 23 08:57:31 EST 2017

[nm] Add skeleton for nm

This is only a placeholder for nm. It only defines
the Makefile rules and a basic main with an usage.

diff: cannot open b/nm//null: file does not exist: 'b/nm//null'
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
 driver/posix/scpp
 rootdir/
 ar/ar-*
+nm/nm
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # scc - Suckless C Compiler
 .POSIX:
 
-DIRS  = inc cc1 cc2 driver lib as ar
+DIRS  = inc cc1 cc2 driver lib as ar nm
 
 FORALL = @set -e ;\
 	pwd=$$PWD; \
--- /dev/null
+++ b/nm/Makefile
@@ -1,0 +1,21 @@
+.POSIX:
+
+LIBDIR    = ../lib/scc
+include ../config.mk
+include $(LIBDIR)/libdep.mk
+
+OBJ       = main.o
+
+all: nm
+
+nm: $(OBJ) $(LIBDIR)/libscc.a
+	$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
+
+$(LIBDIR)/libscc.a: $(LIB-OBJ)
+	cd $(LIBDIR) && $(MAKE)
+
+dep:
+clean:
+	rm -f nm *.o
+
+distclean: clean
--- /dev/null
+++ b/nm/main.c
@@ -1,0 +1,37 @@
+static char sccsid[] = "@(#) ./nm/main.c";
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "../inc/arg.h"
+#include "../inc/scc.h"
+
+char *argv0;
+
+void
+usage(void)
+{
+	fputs("nm [-APv][-efox][ -g| -u][-t format] file...\n", stderr);
+	exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+	ARGBEGIN {
+	case 'A':
+	case 'e':
+	case 'f':
+	case 'g':
+	case 'o':
+	case 'u':
+	case 'v':
+	case 'x':
+	/* case 't': */
+		;
+	default:
+		usage();
+	} ARGEND
+
+	return 0;
+}