Add Makefiles, utility
Change the directory structure and add a bunch of Makefiles to make it easy to install gitto. Also add a utility to run gitto in its current state.
This commit is contained in:
parent
5e17738e22
commit
d7a622d4ba
7 changed files with 72 additions and 7 deletions
20
Makefile
Normal file
20
Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
export DESTDIR ?= /usr
|
||||
|
||||
dirs = src gitto
|
||||
install-dirs = $(addprefix install-,$(dirs))
|
||||
uninstall-dirs = $(addprefix uninstall-,$(dirs))
|
||||
|
||||
.PHONY: all $(dirs) install $(install-dirs) uninstall $(uninstall-dirs)
|
||||
|
||||
all: $(dirs)
|
||||
install: $(install-dirs)
|
||||
uninstall: $(uninstall-dirs)
|
||||
|
||||
$(dirs):
|
||||
$(MAKE) -C $@/
|
||||
|
||||
$(install-dirs): install-%:
|
||||
$(MAKE) -C $*/ install
|
||||
|
||||
$(uninstall-dirs): uninstall-%:
|
||||
$(MAKE) -C $*/ uninstall
|
1
gitto/.gitignore
vendored
Normal file
1
gitto/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.go
|
25
gitto/Makefile
Normal file
25
gitto/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
DESTDIR ?= /usr/local
|
||||
|
||||
objects = main.go main.scm
|
||||
install-objects = $(addprefix install-,$(objects))
|
||||
uninstall-objects = $(addprefix uninstall-,$(objects))
|
||||
|
||||
$(filter %.go,$(objects)): %.go: %.scm
|
||||
guile-tools compile -o $@ $^
|
||||
|
||||
.PHONY: install $(install-objects) uninstall $(uninstall-objects)
|
||||
|
||||
install: $(install-objects)
|
||||
uninstall: $(uninstall-objects)
|
||||
|
||||
$(filter %.go,$(install-objects)): install-%:
|
||||
install -Dm 644 $* $(DESTDIR)/lib/guile/2.0/ccache/gitto/$*
|
||||
|
||||
$(filter %.scm,$(install-objects)): install-%:
|
||||
install -Dm 644 $* $(DESTDIR)/share/guile/2.0/gitto/$*
|
||||
|
||||
$(filter %.go,$(uninstall-objects)): uninstall-%:
|
||||
rm -f $(DESTDIR)/lib/guile/2.0/ccache/gitto/$*
|
||||
|
||||
$(filter %.scm,$(uninstall-objects)): uninstall-%:
|
||||
rm -f $(DESTDIR)/share/guile/2.0/gitto/$*
|
13
gitto.scm → gitto/main.scm
Executable file → Normal file
13
gitto.scm → gitto/main.scm
Executable file → Normal file
|
@ -1,10 +1,9 @@
|
|||
#! /usr/bin/guile \
|
||||
-e main -s
|
||||
!#
|
||||
(use-modules (ice-9 format)
|
||||
(ice-9 getopt-long)
|
||||
(ice-9 popen)
|
||||
(ice-9 rdelim))
|
||||
(define-module (gitto main)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 getopt-long)
|
||||
#:use-module (ice-9 popen)
|
||||
#:use-module (ice-9 rdelim)
|
||||
#:export (main))
|
||||
|
||||
(define data-dir
|
||||
(let ((xdg (getenv "XGD_DATA_HOME"))
|
5
run-gitto
Executable file
5
run-gitto
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
export GUILE_LOAD_PATH="$(dirname $(realpath $0)):$GUILE_LOAD_PATH"
|
||||
export GUILE_LOAD_COMPILED_PATH="$(dirname $(realpath $0)):$GUILE_LOAD_PATH"
|
||||
exec src/gitto "$@"
|
11
src/Makefile
Normal file
11
src/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
|||
DESTDIR ?= /usr/local
|
||||
|
||||
all:
|
||||
|
||||
.PHONY: install uninstall
|
||||
|
||||
install: gitto
|
||||
install -Dm 755 $^ ${DESTDIR}/bin/$^
|
||||
|
||||
uninstall: gitto
|
||||
rm -f ${DESTDIR}/bin/$^
|
4
src/gitto
Executable file
4
src/gitto
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
BOOT="((@ (gitto main) main) (program-arguments))"
|
||||
exec guile $GUILE_FLAGS -c "$BOOT" "$0" "$@"
|
Loading…
Reference in a new issue