From 36c6e0505308b0e1d96a4a1c3626a841ae19ecea Mon Sep 17 00:00:00 2001 From: Nathan Misner Date: Tue, 17 Jan 2023 09:26:10 -0500 Subject: [PATCH] makefile --- .gitignore | 5 +++++ Makefile | 24 ++++++++++++++++++++++++ a65.c | 2 +- a65eval.c | 10 ++++++---- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 09a5545..11d8202 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,11 @@ madoola.lst madoola.bin variables.asm +# build artifacts +*.o +*.d +a65 + # User-specific files *.rsuser *.suo diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8f59a80 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +CC = gcc + +TARGET = a65 + +CFLAGS = -g -std=c89 -Wall -Wvla -O0 -MMD + +OBJECTS = a65.o \ + a65eval.o \ + a65util.o + +DEPENDS = $(OBJECTS:.o=.d) + +all: $(TARGET) + +clean: + rm *.o *.d + +$(TARGET): $(OBJECTS) + $(CC) $(CFLAGS) -o $@ $(OBJECTS) + +%.o: %.c + $(CC) -c $(CFLAGS) -o $@ $< + +-include $(DEPENDS) diff --git a/a65.c b/a65.c index 5059ae9..57356a7 100644 --- a/a65.c +++ b/a65.c @@ -81,7 +81,7 @@ static void pseudo_op(); static int done, ifsp, off; -void main(int argc, char **argv) { +int main(int argc, char **argv) { SCRATCH unsigned *o; printf("6502 Cross-Assembler (Portable) Ver 0.2n\n"); diff --git a/a65eval.c b/a65eval.c index 82a68f1..67caa79 100644 --- a/a65eval.c +++ b/a65eval.c @@ -47,6 +47,8 @@ expression analyzer processes the token stream into unsigned results of arithmetic expressions. */ +#include + /* Get global goodies: */ #include "a65.h" @@ -67,7 +69,7 @@ static void exp_error(char c); static void make_number(unsigned base); static int isnum(char c); static int ishex(char c); -static int isalnum(char c); +static int isalphnum(char c); /* Machine opcode argument field parsing routine. The token stream */ /* from the lexical analyzer is processed to extract addressing mode */ @@ -174,7 +176,7 @@ static unsigned eval(unsigned pre) { case IMM: exp_error('S'); break; case SEP: if (pre != START) unlex(); - case EOL: exp_error('E'); return; + case EOL: exp_error('E'); return 0; case OPR: if (!(token.attr & UNARY)) { exp_error('E'); break; } @@ -402,7 +404,7 @@ static int ishex(char c) { return isnum(c) || ((c = toupper(c)) >= 'A' && c <= 'F'); } -static int isalnum(char c) { +static int isalphnum(char c) { return isalph(c) || isnum(c); } @@ -419,7 +421,7 @@ void unlex() { void pops(char *s) { trash(); - for (; isalnum(*s = popc()); ++s); + for (; isalphnum(*s = popc()); ++s); pushc(*s); *s = '\0'; return; } -- 2.45.2