Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
42 changes: 0 additions & 42 deletions .github/workflows/fox32-run-cputest.yml

This file was deleted.

23 changes: 6 additions & 17 deletions .github/workflows/fox32-unstable-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download latest fox32rom artifact
uses: dawidd6/action-download-artifact@v2
- uses: cachix/install-nix-action@v22
with:
repo: fox32-arch/fox32rom
workflow: fox32rom-unstable.yml
workflow_conclusion: success

- name: Move fox32.rom into the root folder
run: |
mv fox32.rom/ download/
cp download/fox32.rom ./fox32.rom
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install libsdl2-dev and vim
run: |
sudo apt update
sudo apt install -y libsdl2-dev vim
- name: Build fox32
run: nix build -L .#fox32

- name: Build
run: make
- name: Patch
run: nix run nixpkgs#patchelf -- result/bin/fox32 --set-interpreter /lib64/ld-linux-x86-64.so.2 --output fox32

- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ fox32.html
fox32.wasm
fox32.js
fox32.data

**/result
.direnv/
39 changes: 10 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
TARGET = linux
ifeq ($(TARGET),linux)
# default is used for CC
SDL2_CONFIG = sdl2-config
SDL2_CONFIG ?= sdl2-config
FOX32ROM_IN ?= fox32.rom

FOX32ROM_OUT = fox32rom.h
CFLAGS += -g -Ofast -std=c99 -Wall -Wextra `$(SDL2_CONFIG) --cflags`
LDFLAGS += `$(SDL2_CONFIG) --libs`
else
ifeq ($(TARGET),mingw)
CC = x86_64-w64-mingw32-gcc
CFLAGS += -g -Ofast -std=c99 -Wall -Wextra -DWINDOWS
LDFLAGS += -lmingw32 -lSDL2main -lSDL2
TARGET_FILE_EXTENSION = .exe
else
ifeq ($(TARGET),wasm)
CC = emcc
CFLAGS += -O3 -std=c99 -Wall -Wextra
LDFLAGS += -s TOTAL_MEMORY=70057984 -sALLOW_MEMORY_GROWTH=1 -sUSE_SDL=2 --preload-file fox32os.img
TARGET_EXTRADEPS = fox32os.img
TARGET_FILE_EXTENSION = .html
else
$(error unknown TARGET)
endif
endif
endif

CFILES = src/main.c \
src/bus.c \
Expand All @@ -37,20 +19,19 @@ CFILES = src/main.c \
OBJS = $(addsuffix .o, $(basename $(CFILES)))

.PHONY: all
all: fox32$(TARGET_FILE_EXTENSION)

FOX32ROM_IN = fox32.rom
FOX32ROM_OUT = fox32rom.h
all: fox32

$(FOX32ROM_OUT): $(FOX32ROM_IN)
xxd -i $(FOX32ROM_IN) $(FOX32ROM_OUT)
cp $(FOX32ROM_IN) fox32.rom
xxd -i fox32.rom $(FOX32ROM_OUT)
rm -f fox32.rom
sed -i -e 's/fox32_rom/fox32rom/' $(FOX32ROM_OUT)

fox32$(TARGET_FILE_EXTENSION): $(TARGET_EXTRADEPS) $(OBJS)
fox32: $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)

%.o: %.c $(FOX32ROM_OUT)
$(CC) -o $@ -c $< $(CFLAGS)

clean:
rm -rf fox32 fox32.exe fox32.wasm fox32.html fox32.data fox32.js fox32rom.h $(OBJS)
rm -rf fox32 $(FOX32ROM_OUT) $(OBJS)
Loading