From 87765b2b92f5fa58f270c21d0df52be42e7d3d0d Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Mon, 15 Apr 2024 13:40:10 +0200 Subject: [PATCH] add make install and tolling similar to x48ng's --- Makefile | 28 +++++++++++++++++++++++----- {ROMs => dist/ROMs}/Makefile | 0 {ROMs => dist/ROMs}/gxrom-l | Bin {ROMs => dist/ROMs}/gxrom-m | Bin {ROMs => dist/ROMs}/gxrom-p | Bin {ROMs => dist/ROMs}/gxrom-r | Bin {ROMs => dist/ROMs}/sxrom-a | Bin {ROMs => dist/ROMs}/sxrom-b | Bin {ROMs => dist/ROMs}/sxrom-c | Bin {ROMs => dist/ROMs}/sxrom-d | Bin {ROMs => dist/ROMs}/sxrom-e | Bin {ROMs => dist/ROMs}/sxrom-j | Bin dist/hpemu.desktop | 9 +++++++++ dist/hplogo.png | Bin 0 -> 4456 bytes dist/setup-hpemu-home.sh | 11 +++++++++++ src/files.c | 2 +- src/rpl.c | 31 ++++++++++++------------------- 17 files changed, 56 insertions(+), 25 deletions(-) rename {ROMs => dist/ROMs}/Makefile (100%) rename {ROMs => dist/ROMs}/gxrom-l (100%) rename {ROMs => dist/ROMs}/gxrom-m (100%) rename {ROMs => dist/ROMs}/gxrom-p (100%) rename {ROMs => dist/ROMs}/gxrom-r (100%) rename {ROMs => dist/ROMs}/sxrom-a (100%) rename {ROMs => dist/ROMs}/sxrom-b (100%) rename {ROMs => dist/ROMs}/sxrom-c (100%) rename {ROMs => dist/ROMs}/sxrom-d (100%) rename {ROMs => dist/ROMs}/sxrom-e (100%) rename {ROMs => dist/ROMs}/sxrom-j (100%) create mode 100644 dist/hpemu.desktop create mode 100644 dist/hplogo.png create mode 100755 dist/setup-hpemu-home.sh diff --git a/Makefile b/Makefile index 624e16c..286d168 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +PREFIX = /usr +DOCDIR = $(PREFIX)/doc/hpemu + CC = gcc LIBS = $(shell pkg-config --libs sdl2 SDL2_ttf) CFLAGS = -Wall -Werror -O3 -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=missing-braces -Wno-error=incompatible-pointer-types @@ -22,11 +25,6 @@ dist/hpemu: src/bus.o \ src/timers.o $(CC) $(CFLAGS) $(LIBS) -o $@ $+ -# Installing - -get-roms: - make -C ROMs get-roms - # Cleaning clean: -rm src/*.o @@ -39,3 +37,23 @@ clean-all: mrproper # Formatting pretty-code: clang-format -i src/*.c src/*.h + +# Installing +get-roms: + make -C dist/ROMs get-roms + +install: all get-roms + install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin + install -c -m 755 dist/hpemu $(DESTDIR)$(PREFIX)/bin/hpemu + + install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/hpemu + install -c -m 644 dist/hplogo.png $(DESTDIR)$(PREFIX)/share/hpemu/hplogo.png + cp -R dist/ROMs/ $(DESTDIR)$(PREFIX)/share/hpemu/ + sed "s|@PREFIX@|$(PREFIX)|g" dist/setup-hpemu-home.sh > $(DESTDIR)$(PREFIX)/share/hpemu/setup-hpemu-home.sh + chmod 755 $(DESTDIR)$(PREFIX)/share/hpemu/setup-hpemu-home.sh + + install -m 755 -d -- $(DESTDIR)$(DOCDIR) + cp -R ./*.txt $(DESTDIR)$(DOCDIR) + + install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/applications + sed "s|@PREFIX@|$(PREFIX)|g" dist/hpemu.desktop > $(DESTDIR)$(PREFIX)/share/applications/hpemu.desktop diff --git a/ROMs/Makefile b/dist/ROMs/Makefile similarity index 100% rename from ROMs/Makefile rename to dist/ROMs/Makefile diff --git a/ROMs/gxrom-l b/dist/ROMs/gxrom-l similarity index 100% rename from ROMs/gxrom-l rename to dist/ROMs/gxrom-l diff --git a/ROMs/gxrom-m b/dist/ROMs/gxrom-m similarity index 100% rename from ROMs/gxrom-m rename to dist/ROMs/gxrom-m diff --git a/ROMs/gxrom-p b/dist/ROMs/gxrom-p similarity index 100% rename from ROMs/gxrom-p rename to dist/ROMs/gxrom-p diff --git a/ROMs/gxrom-r b/dist/ROMs/gxrom-r similarity index 100% rename from ROMs/gxrom-r rename to dist/ROMs/gxrom-r diff --git a/ROMs/sxrom-a b/dist/ROMs/sxrom-a similarity index 100% rename from ROMs/sxrom-a rename to dist/ROMs/sxrom-a diff --git a/ROMs/sxrom-b b/dist/ROMs/sxrom-b similarity index 100% rename from ROMs/sxrom-b rename to dist/ROMs/sxrom-b diff --git a/ROMs/sxrom-c b/dist/ROMs/sxrom-c similarity index 100% rename from ROMs/sxrom-c rename to dist/ROMs/sxrom-c diff --git a/ROMs/sxrom-d b/dist/ROMs/sxrom-d similarity index 100% rename from ROMs/sxrom-d rename to dist/ROMs/sxrom-d diff --git a/ROMs/sxrom-e b/dist/ROMs/sxrom-e similarity index 100% rename from ROMs/sxrom-e rename to dist/ROMs/sxrom-e diff --git a/ROMs/sxrom-j b/dist/ROMs/sxrom-j similarity index 100% rename from ROMs/sxrom-j rename to dist/ROMs/sxrom-j diff --git a/dist/hpemu.desktop b/dist/hpemu.desktop new file mode 100644 index 0000000..ad69a24 --- /dev/null +++ b/dist/hpemu.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Exec=@PREFIX@/bin/hpemu +Name=hpemu +Icon=@PREFIX@/share/hpemu/hplogo.png +Categories=Utility; diff --git a/dist/hplogo.png b/dist/hplogo.png new file mode 100644 index 0000000000000000000000000000000000000000..a4fff9fe4fdccab3f3c501f92d1b4f5b056461ca GIT binary patch literal 4456 zcmeHKYfuzd79LPulc4bhXhhnM; zJ$?J0ufKE7ch5c5cc)=hQm}BIP#_Ql>yowU;9kgIK2yN|Pd&XQ;C3-T)5xV0Zpg_x z%#4+WxI8Bf(H_Pu5O}__8D5-r9trGgjmq6t*j(IMyJ2a!|8oP$@yBwj4uuu{`RTyM zyZyq_X-k62Q(CHAvXWiw2eqH=R8$;%a)Gh@mgAvQXkBdFR#0}f;M#pzM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(*3-nLtp{M+=l&-t-so%3~aOm#M zi&NbHw9Mar)@Si{Kc7ykxvbp&@pm#(z3Aq-i1uU02O6~4=Lg-T_wO~wM@;v5|BsXaucV3(bhh0N^_y`o@pa+;^*;no+mroMPq3xv_wR*I z4_~ySt?-UaUah+f=fv#uZ#hz9CM)(<7cA|16YI^wj dsktop ) return 0; @@ -163,24 +157,23 @@ address rpl_make_temp( address size ) void rpl_push( address adr ) { - address dsktop, avmem; + address avmem = read_address( AVMEM ); - avmem = read_address( AVMEM ); if ( !avmem ) return; write_address( AVMEM, avmem - 1 ); - dsktop = read_address( DSKTOP ); + address dsktop = read_address( DSKTOP ); dsktop -= 5; + write_address( dsktop, adr ); write_address( DSKTOP, dsktop ); } int rpl_push_object( byte* obj, address size ) { - address adr; + address adr = rpl_make_temp( size ); - adr = rpl_make_temp( size ); if ( !adr ) return -1;