diff --git a/.gitignore b/.gitignore index 0cd4283..ca98435 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ lib/target dmd5620 /.ccls /.ccls-cache +/compile_flags.txt diff --git a/Makefile b/Makefile index b6a0163..cfec6d0 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,14 @@ PREFIX := /usr/local endif ifdef DEBUG -CFLAGS+ = -g -O0 + CFLAGS+ = -g -O0 else -CFLAGS += -O3 -Os -s + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + CFLAGS += -O3 -Os + else + CFLAGS += -O3 -Os -s + endif endif .PHONY: all clean diff --git a/src/dmd_5620.c b/src/dmd_5620.c index 831fc9b..43be13f 100644 --- a/src/dmd_5620.c +++ b/src/dmd_5620.c @@ -33,7 +33,13 @@ #include #include #include +#if defined __APPLE__ +#include +#include +#include +#else #include +#endif #include #include #include @@ -333,8 +339,6 @@ pty_io_poll() } } } - } else { - fprintf(stderr, "Nothing to poll!!\n"); } i = 0; @@ -442,11 +446,15 @@ tty_set_blocking(int fd, int should_block) } } +#ifdef __APPLE__ + +#endif + /* * This is the main thread for stepping the DMD emulator. */ static void * -dmd_cpu_thread(void *threadid) +dmd_cpu_thread(void *thread_id) { struct timespec sleep_time_req, sleep_time_rem; int size; @@ -795,7 +803,7 @@ int main(int argc, char *argv[]) { int c, errflg = 0; - long thread_id = 0; + pthread_t thread_id = 0; int rs; char *shell = NULL; char *device = NULL;