Allow a suffix (e.g. the version) to be added when installing (#1406)

This commit is contained in:
Sylvie
2024-06-18 16:06:43 -04:00
committed by GitHub
parent ee748cfe26
commit 0433714d77
3 changed files with 24 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ Q := @
PREFIX := /usr/local PREFIX := /usr/local
bindir := ${PREFIX}/bin bindir := ${PREFIX}/bin
mandir := ${PREFIX}/share/man mandir := ${PREFIX}/share/man
SUFFIX :=
STRIP := -s STRIP := -s
BINMODE := 755 BINMODE := 755
MANMODE := 644 MANMODE := 644
@@ -185,7 +186,10 @@ clean:
install: all install: all
$Qinstall -d ${DESTDIR}${bindir}/ ${DESTDIR}${mandir}/man1/ ${DESTDIR}${mandir}/man5/ ${DESTDIR}${mandir}/man7/ $Qinstall -d ${DESTDIR}${bindir}/ ${DESTDIR}${mandir}/man1/ ${DESTDIR}${mandir}/man5/ ${DESTDIR}${mandir}/man7/
$Qinstall ${STRIP} -m ${BINMODE} rgbasm rgblink rgbfix rgbgfx ${DESTDIR}${bindir}/ $Qinstall ${STRIP} -m ${BINMODE} rgbasm ${DESTDIR}${bindir}/rgbasm${SUFFIX}
$Qinstall ${STRIP} -m ${BINMODE} rgblink ${DESTDIR}${bindir}/rgblink${SUFFIX}
$Qinstall ${STRIP} -m ${BINMODE} rgbfix ${DESTDIR}${bindir}/rgbfix${SUFFIX}
$Qinstall ${STRIP} -m ${BINMODE} rgbgfx ${DESTDIR}${bindir}/rgbgfx${SUFFIX}
$Qinstall -m ${MANMODE} man/rgbasm.1 man/rgblink.1 man/rgbfix.1 man/rgbgfx.1 ${DESTDIR}${mandir}/man1/ $Qinstall -m ${MANMODE} man/rgbasm.1 man/rgblink.1 man/rgbfix.1 man/rgbgfx.1 ${DESTDIR}${mandir}/man1/
$Qinstall -m ${MANMODE} man/rgbds.5 man/rgbasm.5 man/rgblink.5 ${DESTDIR}${mandir}/man5/ $Qinstall -m ${MANMODE} man/rgbds.5 man/rgbasm.5 man/rgblink.5 ${DESTDIR}${mandir}/man5/
$Qinstall -m ${MANMODE} man/rgbds.7 man/gbz80.7 ${DESTDIR}${mandir}/man7/ $Qinstall -m ${MANMODE} man/rgbds.7 man/gbz80.7 ${DESTDIR}${mandir}/man7/

View File

@@ -40,6 +40,22 @@ cmake --build build
cmake --install build cmake --install build
``` ```
Two parameters available when building are a prefix (e.g. to put the executables in a directory)
and a suffix (e.g. to append the version number or commit ID).
```sh
make
sudo make install PREFIX=install_dir/ SUFFIX=-$(git rev-parse --short HEAD)
```
```sh
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSUFFIX=-$(git rev-parse --short HEAD)
cmake --build build
cmake --install build --prefix install_dir
```
(If you set a `SUFFIX`, it should include the `.exe` extension on Windows.)
## 2. RGBDS Folder Organization ## 2. RGBDS Folder Organization
The RGBDS source code file structure is as follows: The RGBDS source code file structure is as follows:

View File

@@ -91,6 +91,9 @@ foreach(PROG "asm" "fix" "gfx" "link")
${rgb${PROG}_src} ${rgb${PROG}_src}
${common_src} ${common_src}
) )
if(SUFFIX)
set_target_properties(rgb${PROG} PROPERTIES SUFFIX ${SUFFIX})
endif()
install(TARGETS rgb${PROG} RUNTIME DESTINATION bin) install(TARGETS rgb${PROG} RUNTIME DESTINATION bin)
endforeach() endforeach()