shithub: m8c

Download patch

ref: 445c58683235515384ed1ebc3757209b4077b0b2
parent: d00e51c0c1f2170c1f4d0838bbcd0e52e534bcef
author: Daniel Hooper <44912292+daniel214@users.noreply.github.com>
date: Sun Feb 27 13:48:48 EST 2022

Update to build clean on macOS 10.11 with M1 cpu

--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,12 @@
 DEPS = serial.h slip.h command.h write.h render.h ini.h config.h input.h
 
 #Any special libraries you are using in your project (e.g. -lbcm2835 -lrt `pkg-config --libs gtk+-3.0` ), or leave blank
-INCLUDES = -lserialport
+INCLUDES = $(shell pkg-config --libs sdl2 libserialport)
 
+
+
 #Set any compiler flags you want to use (e.g. -I/usr/include/somefolder `pkg-config --cflags gtk+-3.0` ), or leave blank
-CFLAGS = `sdl2-config --libs --cflags` -march=native -Wall -O2 -pipe -I.
+CFLAGS = $(shell pkg-config --cflags sdl2 libserialport) -mcpu=apple-m1 -Wall -O2 -pipe -I.
 
 #Set the compiler you are using ( gcc for C or g++ for C++ )
 CC = gcc
@@ -26,7 +28,7 @@
 	$(CC) -o $@ $^ $(CFLAGS) $(INCLUDES)
 
 font.c: inline_font.h
-	@echo "#include <SDL2/SDL.h>" > $@-tmp1
+	@echo "#include <SDL.h>" > $@-tmp1
 	@cat inline_font.h >> $@-tmp1
 	@cat inprint2.c > $@-tmp2
 	@sed '/#include/d' $@-tmp2 >> $@-tmp1
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@
 This assumes you have [installed brew](https://docs.brew.sh/Installation)
 
 ```
-brew update && brew install -y git gcc make sdl2 libserialport
+brew update && brew install -y git gcc make sdl2 libserialport pkg-config
 ```
 ### Download source code (All)
 
--- a/SDL2_inprint.h
+++ b/SDL2_inprint.h
@@ -5,7 +5,7 @@
 #ifndef SDL2_inprint_h
 #define SDL2_inprint_h
 
-#include <SDL2/SDL.h>
+#include <SDL.h>
 
 extern void prepare_inline_font(void);
 extern void kill_inline_font(void);
--- a/command.c
+++ b/command.c
@@ -1,7 +1,7 @@
 // Copyright 2021 Jonne Kokkonen
 // Released under the MIT licence, https://opensource.org/licenses/MIT
 
-#include <SDL2/SDL_log.h>
+#include <SDL_log.h>
 
 #include "command.h"
 #include "render.h"
--- a/config.c
+++ b/config.c
@@ -2,7 +2,7 @@
 // Released under the MIT licence, https://opensource.org/licenses/MIT
 
 #include "config.h"
-#include <SDL2/SDL.h>
+#include <SDL.h>
 
 config_params_s init_config() {
   config_params_s c;
@@ -259,4 +259,4 @@
   if (gamepad_analog_axis_start) conf->gamepad_analog_axis_start = SDL_atoi(gamepad_analog_axis_start);
   if (gamepad_analog_axis_opt) conf->gamepad_analog_axis_opt = SDL_atoi(gamepad_analog_axis_opt);
   if (gamepad_analog_axis_edit) conf->gamepad_analog_axis_edit = SDL_atoi(gamepad_analog_axis_edit);
-}
\ No newline at end of file
+}
--- a/input.c
+++ b/input.c
@@ -1,7 +1,7 @@
 // Copyright 2021 Jonne Kokkonen
 // Released under the MIT licence, https://opensource.org/licenses/MIT
 
-#include <SDL2/SDL.h>
+#include <SDL.h>
 #include <stdio.h>
 
 #include "config.h"
@@ -419,4 +419,4 @@
     // Special event keys already have the correct keycode baked in
     return key;
   }
-}
\ No newline at end of file
+}
--- a/main.c
+++ b/main.c
@@ -1,7 +1,7 @@
 // Copyright 2021 Jonne Kokkonen
 // Released under the MIT licence, https://opensource.org/licenses/MIT
 
-#include <SDL2/SDL.h>
+#include <SDL.h>
 #include <libserialport.h>
 #include <signal.h>
 #include <string.h>
--- a/render.c
+++ b/render.c
@@ -3,7 +3,7 @@
 
 #include "render.h"
 
-#include <SDL2/SDL.h>
+#include <SDL.h>
 #include <stdio.h>
 
 #include "SDL2_inprint.h"
@@ -196,4 +196,4 @@
       fps = 0;
     }
   }
-}
\ No newline at end of file
+}
--- a/serial.c
+++ b/serial.c
@@ -4,7 +4,7 @@
 // Contains portions of code from libserialport's examples released to the
 // public domain
 
-#include <SDL2/SDL_log.h>
+#include <SDL_log.h>
 #include <libserialport.h>
 #include <stdio.h>
 #include <stdlib.h>
--- a/write.c
+++ b/write.c
@@ -1,7 +1,7 @@
 // Copyright 2021 Jonne Kokkonen
 // Released under the MIT licence, https://opensource.org/licenses/MIT
 
-#include <SDL2/SDL_log.h>
+#include <SDL_log.h>
 #include <libserialport.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -83,4 +83,4 @@
   }
 
   return 1;
-}
\ No newline at end of file
+}
--