Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
koobo committed Nov 21, 2023
2 parents 30bffa8 + b6436c1 commit 67deffe
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/makefile.yml
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

schedule:
- cron: '* * 1/7 * *'
- cron: '00 12 * * 1'

jobs:
build:
Expand All @@ -21,6 +21,9 @@ jobs:
with:
submodules: recursive

- name: Trust git workdir
run: git config --global --add safe.directory $PWD

- name: Clean
run: make clean

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@
*.o
test_blaster
/*.sym
/git.gen.*
28 changes: 22 additions & 6 deletions Makefile
Expand Up @@ -15,25 +15,41 @@ INCLUDES := playsid_libdefs.i external.asm resid-68k/resid-68k.s resid-68k/resid
TARGET := playsid.library test_blaster
LISTFILE := playsid.txt

##
## Generate a C header / ASM include file with the current git hash
##

SHELL=bash # this relies on bash..
GIT_HEADER?=git.gen.h
GIT_INCLUDE?=git.gen.i
GIT :=$(shell git describe --always)# can't use '--dirty' because playsid.library
GIT_DEFINE:='\#define GIT "$(GIT)"'
OLD_DEFINE:='$(shell [[ -e $(GIT_HEADER) ]] && cat $(GIT_HEADER) || echo "nothing")'
GIT_MACRO :='$(shell echo -e 'GIT\tMACRO\r\tdc.b "$(GIT)"\r\tENDM')'
OLD_MACRO :='$(shell [[ -e $(GIT_INCLUDE) ]] && cat $(GIT_INCLUDE) || echo "nothing")'
$(info GIT = $(GIT))
$(shell [[ $(OLD_DEFINE) != $(GIT_DEFINE) ]] && echo -e $(GIT_DEFINE) > $(GIT_HEADER))
$(shell [[ $(OLD_MACRO) != $(GIT_MACRO) ]] && echo -e $(GIT_MACRO) > $(GIT_INCLUDE))

.PHONY: all clean

all: $(TARGET)

clean:
rm -f $(TARGET) $(LISTFILE) playsid.map test_blaster.map *.o *.sym
rm -f $(TARGET) $(LISTFILE) playsid.map test_blaster.map *.o *.sym $(GIT_HEADER) $(GIT_INCLUDE)

playsid.o: playsid.asm $(INCLUDES) Makefile
playsid.o: playsid.asm $(INCLUDES) $(GIT_INCLUDE) Makefile
$(VASM) $< -o $@ -L $(LISTFILE) $(VASM_FLAGS) -Iresid-68k
$(OBJCOPY) --rename-section reSID_data=.data $@

sidblast.o: sidblast.c Makefile
sidblast.o: sidblast.c $(GIT_HEADER) Makefile
$(GCC) -c $< -o $@ $(CFLAGS)

playsid.library.sym: playsid.o sidblast.o | Makefile
playsid.library.sym: playsid.o sidblast.o
$(GCC) -m68020 -nostdlib -g -Wl,-Map,playsid.map,--cref $^ -o $@

playsid.library: playsid.library.sym
$(STRIP) $^ -o $@

test_blaster: test_blaster.c sidblast.c
$(GCC) -O2 -g -noixemul -m68020 --omit-frame-pointer -Wl,-Map,test_blaster.map,--cref $^ -o $@
test_blaster: test_blaster.c sidblast.c $(GIT_HEADER)
$(GCC) -O2 -noixemul -m68020 --omit-frame-pointer -Wl,-Map,test_blaster.map,--cref $^ -o $@
2 changes: 1 addition & 1 deletion docker.sh
Expand Up @@ -5,4 +5,4 @@
# $ ./docker.sh "echo | m68k-amigaos-gcc -dM -E -" | grep __VERSION__

# Use a published container
docker run --volume "$PWD":/host --workdir /host -i -t trixitron/m68k-amigaos-gcc /bin/bash -c "$*"
docker run --volume "$PWD":/host --workdir /host -i -t trixitron/m68k-amigaos-gcc /bin/bash -c "git config --global --add safe.directory \$PWD && $*"
5 changes: 4 additions & 1 deletion playsid_libdefs.i
Expand Up @@ -12,6 +12,7 @@ PLAYSID_LIBDEFS_I SET 1
;************************************************************************
; Private definitions for emul_lib.s
;************************************************************************
include "git.gen.i"

PSIDLIB_VERSION equ 1
PSIDLIB_REVISION equ 6
Expand All @@ -21,7 +22,9 @@ PSIDLIB_NAME MACRO
ENDM

PSIDLIB_IDSTRING MACRO
dc.b "playsid.library 1.6 (7.10.2023) reSID+SIDBlaster",13,10,0
dc.b "playsid.library 1.6 (7.10.2023) reSID+SIDBlaster (git:"
GIT
dc.b ")",13,10,0
ENDM

PSIDLIB_COPYRIGHT MACRO
Expand Down
3 changes: 2 additions & 1 deletion test_blaster.c
Expand Up @@ -6,6 +6,7 @@
#include <string.h>

#include "sidblast.h"
#include "git.gen.h"

uint32_t timeout = 10; // seconds
uint32_t latency = 16; // milliseconds
Expand All @@ -22,7 +23,7 @@ int main(int argc, const char** argv)
if (argc > 3)
taskpri = strtol(argv[3], 0, 10);

printf("%s <timeout:%d> <latency:%d> <taskpri:%d>\n", argv[0], timeout, latency, taskpri);
printf("%s (git:%s) <timeout:%d> <latency:%d> <taskpri:%d>\n", argv[0], GIT, timeout, latency, taskpri);

if (timeout > 1000)
{
Expand Down

0 comments on commit 67deffe

Please sign in to comment.