1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-11 23:43:19 +00:00

Clean up SDL infrastructure, add makefiles for more system/cpu combinations

Rationalize the SDL.h include file references so that they work on all systems

Use the correct macOS Framework options to get include path and library search path

Add makefile fragments for SDL on macOS on Apple Silicon, plus FreeBSD and Linux
on same cpus as X11

Switch to gcc rather than clang as the default compiler for Linux systems
This commit is contained in:
Nick Briggs 2022-11-21 17:18:47 -08:00
parent 4ae1987c33
commit 7d8a7a6668
13 changed files with 168 additions and 15 deletions

2
bin/makefile-cygwin.x86_64-x Executable file → Normal file
View File

@ -1,7 +1,7 @@
# Options for Linux, Intel x86_64 and X-Window
#CC = gcc -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \

View File

@ -0,0 +1,19 @@
# Options for MacOS, x86 processor, SDL
CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL -F /Library/Frameworks
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -F /Library/Frameworks -framework SDL2
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -1,17 +1,17 @@
# Options for MacOS, x86 processor, X windows
# Options for MacOS, x86 processor, SDL
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL -I/Library/Frameworks/SDL2.framework/Headers
SDLFLAGS = -DSDL -F /Library/Frameworks
# OPTFLAGS is normally -O2.
OPTFLAGS = -O1 -g
OPTFLAGS = -O2 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -F/Library/Frameworks -framework SDL2
LDFLAGS = -F /Library/Frameworks -framework SDL2
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/

View File

@ -0,0 +1,18 @@
# Options for FreeBSD, Intel 386/486 and SDL
CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL -I/usr/local/include
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lSDL2 -lm
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -0,0 +1,18 @@
# Options for FreeBSD, ARM64 and SDL
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL -I/usr/local/include
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lSDL2 -lm
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -0,0 +1,18 @@
# Options for FreeBSD, Intel x86_64 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL -I/usr/local/include
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lSDL2 -lm
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -0,0 +1,19 @@
# Options for Linux, Intel 386/486 and SDL
CC = gcc -m32 $(GCC_CFLAGS)
# CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
XFLAGS = -DSDL
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -lm -lSDL2
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -1,7 +1,8 @@
# Options for Linux, Intel 386/486 and X-Window
#CC = gcc -m32 $(GCC_CFLAGS)
CC = clang -m32 $(CLANG_CFLAGS)
CC = gcc -m32 $(GCC_CFLAGS)
# CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
@ -12,7 +13,6 @@ XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.

View File

@ -0,0 +1,19 @@
# Options for Linux, ARM64 and SDL
CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
SDLFLAGS = -DSDL
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(SDLFLAGS) -DRELEASE=351
LDFLAGS = -lSDL2 -lm
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -0,0 +1,19 @@
# Options for Linux, ARMv7 and SDL
CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
XFLAGS = -DSDL
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -lm -lSDL2
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -0,0 +1,19 @@
# Options for Linux, Intel x86_64 and SDL
CC = gcc -m64 $(GCC_CFLAGS)
# CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
XFLAGS = -DSDL
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -lm -lSDL2
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@ -1,7 +1,7 @@
# Options for Linux, Intel x86_64 and X-Window
#CC = gcc -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
CC = gcc -m64 $(GCC_CFLAGS)
# CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \

View File

@ -1,5 +1,5 @@
#include <SDL.h>
#include <SDL_keycode.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_keycode.h>
#include <assert.h>
#include <limits.h>
#include "sdldefs.h"
@ -482,7 +482,7 @@ static void handle_keydown(SDL_Keycode k, unsigned short mod) {
if (lk == -1) {
printf("No mapping for key %s\n", SDL_GetKeyName(k));
} else {
printf("dn %s -> lisp keycode %d (0x%x)\n", SDL_GetKeyName(k), lk, mod);
// printf("dn %s -> lisp keycode %d (0x%x)\n", SDL_GetKeyName(k), lk, mod);
kb_trans(lk - KEYCODE_OFFSET, FALSE);
DoRing();
if ((KBDEventFlg += 1) > 0) Irq_Stk_End = Irq_Stk_Check = 0;
@ -493,7 +493,7 @@ static void handle_keyup(SDL_Keycode k, unsigned short mod) {
if (lk == -1) {
printf("No mapping for key %s\n", SDL_GetKeyName(k));
} else {
printf("up %s -> lisp keycode %d (0x%x)\n", SDL_GetKeyName(k), lk, mod);
// printf("up %s -> lisp keycode %d (0x%x)\n", SDL_GetKeyName(k), lk, mod);
kb_trans(lk - KEYCODE_OFFSET, TRUE);
DoRing();
if ((KBDEventFlg += 1) > 0) Irq_Stk_End = Irq_Stk_Check = 0;
@ -592,10 +592,12 @@ void process_SDLevents() {
}
break;
case SDL_KEYDOWN:
#if 0
printf("dn ts: %x, type: %x, state: %x, repeat: %x, scancode: %x, sym: %x <%s>, mod: %x\n",
event.key.timestamp, event.key.type, event.key.state, event.key.repeat,
event.key.keysym.scancode, event.key.keysym.sym,
SDL_GetKeyName(event.key.keysym.sym), event.key.keysym.mod);
#endif
if (event.key.repeat) {
/* Lisp needs to see the UP transition before the DOWN transition */
handle_keyup(event.key.keysym.sym, event.key.keysym.mod);
@ -603,10 +605,12 @@ void process_SDLevents() {
handle_keydown(event.key.keysym.sym, event.key.keysym.mod);
break;
case SDL_KEYUP:
#if 0
printf("up ts: %x, type: %x, state: %x, repeat: %x, scancode: %x, sym: %x <%s>, mod: %x\n",
event.key.timestamp, event.key.type, event.key.state, event.key.repeat,
event.key.keysym.scancode, event.key.keysym.sym,
SDL_GetKeyName(event.key.keysym.sym), event.key.keysym.mod);
#endif
handle_keyup(event.key.keysym.sym, event.key.keysym.mod);
break;
case SDL_MOUSEMOTION: {
@ -660,7 +664,7 @@ void process_SDLevents() {
/* printf("SDL_KEYMAPCHANGED\n"); break; */
/* case SDL_TEXTINPUT: */
/* printf("SDL_TEXTINPUT\n"); break; */
default: printf("other event type: %d\n", event.type);
default: /* printf("other event type: %d\n", event.type); */ break;
}
}
if (display_update_needed) {