makefile update, win32 fixes

This commit is contained in:
Kelvin Sherlock 2016-12-26 11:03:06 -05:00
parent 6d965d5442
commit f080c2c862
2 changed files with 41 additions and 11 deletions

View File

@ -1,14 +1,28 @@
CC=c++ -std=c++11 -g
CXX=c++ -std=c++11 -g
OBJS = dumpobj.o disasm.o
LINK.o = $(LINK.cc)
CXXFLAGS = -std=c++11 -g
CCFLAGS = -g
CPPFLAGS = -I .
UNAME_S := $(shell uname -s)
OBJS = dumpobj.o disassembler.o
#ifeq ($(UNAME_S),MINGW64_NT-10.0)
ifeq ($(MSYSTEM),MINGW64)
OBJS += err.o
endif
.PHONY: variables
variables :
$(foreach v, $(.VARIABLES), $(info $(v) = $($(v))))
@echo
dumpobj : $(OBJS)
dumpobj : dumpobj.o disassembler.o
disassembler.o : disassembler.cpp disassembler.h
dumpobj.o : dumpobj.cpp disassembler.h
err.o : err.c err.h
.PHONY:
clean
.PHONY: clean
clean:
$(RM) dumpobj $(OBJS)

View File

@ -15,6 +15,10 @@
#include "obj816.h"
#include "disassembler.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
enum class endian {
little = __ORDER_LITTLE_ENDIAN__,
big = __ORDER_BIG_ENDIAN__,
@ -407,26 +411,38 @@ void dump_obj(const char *name, int fd)
break;
case D_C_FILE: {
std::string s = read_cstring(iter);
uint16_t line = read_16(iter);
printf("\t.file\t\"%s\",%d\n", s.c_str(), line);
uint16_t line = read_16(iter);
i += 2;
i += s.length() + 1;
printf("\t.file\t\"%s\", %d\n", s.c_str(), line);
break;
}
case D_C_LINE: {
uint16_t line = read_16(iter);
printf("\t.line\t%d\n", line);
i += 2;
break;
}
case D_C_BLOCK: {
uint16_t block = read_16(iter);
printf("\t.block\t%d\n", block);
i += 2;
break;
}
case D_C_FUNC: {
uint16_t arg = read_16(iter);
printf("\t.function\t%d\n", arg);
i += 2;
break;
}
/*
case D_C_SYM: {
break;
}
*/
default:
errx(EX_DATAERR, "%s: unknown debug opcode %02x", name, op);
errx(EX_DATAERR, "%s: unknown debug opcode %02x (%d)", name, op, op);
break;
}
@ -619,7 +635,7 @@ void dump(const char *name) {
int fd;
ssize_t ok;
fd = open(name, O_RDONLY);
fd = open(name, O_RDONLY | O_BINARY);
if (fd < 0) err(EX_NOINPUT, "Unable to open %s", name);