scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 328defa460951824dd063e52cf2ab377c15544fb
parent c04db5e82d82088e3cfc98c3c58622cc8241d94a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 23 Nov 2017 13:57:31 +0000

[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.

Diffstat:
M.gitignore | 1+
MMakefile | 2+-
Anm/Makefile | 21+++++++++++++++++++++
Anm/main.c | 37+++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore @@ -17,3 +17,4 @@ driver/posix/config.h driver/posix/scpp rootdir/ ar/ar-* +nm/nm diff --git 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; \ diff --git a/nm/Makefile b/nm/Makefile @@ -0,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 diff --git a/nm/main.c b/nm/main.c @@ -0,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; +}