Add disass make rule, change -i option to -f
This commit is contained in:
parent
26457be290
commit
422769d7d9
14
Makefile
14
Makefile
|
@ -19,6 +19,11 @@ trace: CFLAGS += -g -ggdb -DTRACE -lreadline
|
|||
trace: TRACE_SUFFIX = -trace
|
||||
trace: hard
|
||||
|
||||
|
||||
disass: CFLAGS += -DTRACE -lreadline
|
||||
disass: bin/disass.o bin/vm.o
|
||||
$(CC) $(CFLAGS) -o bin/$@ $^
|
||||
|
||||
# TODO: add rule to make rom.h
|
||||
|
||||
bin/%.o: src/%.c
|
||||
|
@ -26,14 +31,15 @@ bin/%.o: src/%.c
|
|||
|
||||
bin/vm.o:
|
||||
bin/main.o:
|
||||
bin/disass.o:
|
||||
|
||||
hard: bin/main.o bin/vm.o
|
||||
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
|
||||
|
||||
clean: cleano
|
||||
rm -f bin/hard bin/hard-trace
|
||||
clean:
|
||||
rm -f bin/*
|
||||
cleano:
|
||||
rm -f bin/main.o bin/vm.o
|
||||
rm -f bin/*.o
|
||||
|
||||
.PHONY: all trace clean
|
||||
.PHONY: all trace clean clean
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
#include "vm.h"
|
||||
|
||||
|
||||
char *usage = "Usage: %s [-z] [-s [start_addr]] -i [vmcodefile]\n"
|
||||
char *usage = "Usage: %s [-z] [-s [start_addr]] -f [vmcodefile]\n"
|
||||
"-z (optional): don't display addresses next to disassembly\n"
|
||||
"-s (optional): start disassembly at 'start_addr' in file\n"
|
||||
"-i (required): path to file to disassemble\n";
|
||||
"-f (required): path to file to disassemble\n";
|
||||
|
||||
/* TODO: eventually reimplement assembler in C (going to be annoying) */
|
||||
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while ((opt = getopt(argc, argv, "zs:i:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "zs:f:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'z':
|
||||
show_addr = false;
|
||||
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
case 'f':
|
||||
strncpy(infile, optarg, 4096-1);
|
||||
break;
|
||||
case '?':
|
||||
|
|
Loading…
Reference in New Issue