Added Linux support.
+Makefile was changed, to produce dispel under linux + mac os and dispel.exe under Windows. +Added make install and make uninstall
This commit is contained in:
parent
4829ae2218
commit
35f15eb06c
2 changed files with 22 additions and 6 deletions
18
Makefile
18
Makefile
|
@ -3,8 +3,16 @@ CFLAGS=-Wall -O2
|
|||
LDFLAGS=
|
||||
SOURCES=main.c 65816.c
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
EXECUTABLE=dispel.exe
|
||||
|
||||
CAN_INSTALL = no
|
||||
ifeq ($(OS),Windows_NT)
|
||||
EXECUTABLE = dispel.exe
|
||||
else
|
||||
EXECUTABLE = dispel
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
CAN_INSTALL = yes
|
||||
endif
|
||||
endif
|
||||
all: $(SOURCES) $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
|
@ -12,6 +20,10 @@ $(EXECUTABLE): $(OBJECTS)
|
|||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
install:
|
||||
cp -v $(EXECUTABLE) /usr/bin
|
||||
#FIXME It ALWAYS copies dispel to /usr/bin, regardless of OS
|
||||
uninstall:
|
||||
rm -rf /usr/bin/$(EXECUTABLE)
|
||||
clean:
|
||||
rm *.o ${EXECUTABLE}
|
||||
|
|
10
main.c
10
main.c
|
@ -11,8 +11,12 @@
|
|||
#ifdef __APPLE__
|
||||
#include <sys/uio.h>
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#include <sys/io.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "dispel.h"
|
||||
|
||||
|
@ -275,12 +279,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
// Read the file into memory
|
||||
#ifdef __APPLE__
|
||||
fseek(fin, 0L, SEEK_END);
|
||||
#if defined(__APPLE__) || defined(__linux__)
|
||||
fseek(fin, 0L, SEEK_END); //Apple and linux code
|
||||
len = ftell(fin);
|
||||
fseek(fin, 0L, SEEK_SET);
|
||||
#else
|
||||
len = filelength(fileno(fin));
|
||||
len = filelength(fileno(fin)); //Windows code
|
||||
#endif
|
||||
|
||||
// Make sure the image is big enough
|
||||
|
|
Loading…
Reference in a new issue