aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-06-25 00:20:01 +0200
committerMattias Andrée <maandree@operamail.com>2013-06-25 00:20:01 +0200
commite77367e2e718df26c65b69ce4974048541018f00 (patch)
treefaff84c6d3800ab41a74a77e120ae505dbadcb5f /Makefile
parentmove texinfo files into directory info (diff)
downloadadjbacklight-78144d6e50b1103e7eb9f7618997c74f1a6d8cb5.tar.gz
adjbacklight-78144d6e50b1103e7eb9f7618997c74f1a6d8cb5.tar.bz2
adjbacklight-78144d6e50b1103e7eb9f7618997c74f1a6d8cb5.tar.xz
improvements to makefile5
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile60
1 files changed, 39 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index afd027f..f94ecfe 100644
--- a/Makefile
+++ b/Makefile
@@ -9,22 +9,32 @@
PREFIX=/usr
-
-PROGRAM=adjbacklight
-BOOK=$(PROGRAM)
+BIN=/bin
+DATA=/share
+LICENSES=$(DATA)/licenses
+PKGNAME=adjbacklight
+COMMAND=adjbacklight
+BINCLASS=$(DATA)/misc
+
+BOOK=adjbacklight
BOOKDIR=info/
# compile the package
.PHONY: all
-all: java info
-
+all: code info
+code: bash java
+bash: adjbacklight.install
java: Adjbacklight.class
%.class: %.java
javac -cp . "$<"
+adjbacklight.install: adjbacklight
+ cp "$<" "$@"
+ sed -i 's:\$${BASH_SOURCE%/\*}:$(PREFIX)$(BINCLASS):g' "adjbacklight.install"
+
info: $(BOOK).info.gz
%.info: $(BOOKDIR)%.texinfo
$(MAKEINFO) "$<"
@@ -60,27 +70,35 @@ dvi.xz: $(BOOK).dvi.xz
# install to system
-.PHONY: install
-install:
- mkdir -p "$(DESTDIR)$(PREFIX)/bin"
- mkdir -p "$(DESTDIR)$(PREFIX)/share/licenses/$(PROGRAM)"
- mkdir -p "$(DESTDIR)$(PREFIX)/share/info/"
- install -m 755 "$(PROGRAM)" "$(DESTDIR)$(PREFIX)/bin/"
- install -m 644 Adjbacklight.class "$(DESTDIR)$(PREFIX)/bin/"
- install -m 644 COPYING "$(DESTDIR)$(PREFIX)/share/licenses/$(PROGRAM)"
- install -m 644 LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/$(PROGRAM)"
- install -m 644 "$(BOOK).info.gz" "$(DESTDIR)$(PREFIX)/share/info"
+install: install-cmd install-license install-info
+
+install-cmd: adjbacklight.install Adjbacklight.class
+ mkdir -p "$(DESTDIR)$(PREFIX)$(BIN)"
+ mkdir -p "$(DESTDIR)$(PREFIX)$(BINCLASS)"
+ install -m 755 "adjbacklight.install" "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
+ install -m 644 "Adjbacklight.class" "$(DESTDIR)$(PREFIX)$(BINCLASS)/Adjbacklight.class"
+
+install-license:
+ mkdir -p "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
+ install -m 644 COPYING LICENSE "$(DESTDIR)$(PREFIX)$(DATA)$(LICENSES)/$(PKGNAME)"
+
+install-info: $(BOOK).info.gz
+ mkdir -p "$(DESTDIR)$(PREFIX)$(DATA)/info"
+ install -m 644 "$(BOOK).info.gz" "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+
# remove files created by `install`
-.PHONY: uninstall
uninstall:
- unlink "$(DESTDIR)$(PREFIX)/bin/Adjbacklight.class"
- unlink "$(DESTDIR)$(PREFIX)/bin/$(PROGRAM)"
- rm -r "$(DESTDIR)$(PREFIX)/share/licenses/$(PROGRAM)"
- rm "$(DESTDIR)$(PREFIX)/share/info/$(BOOK).info.gz"
+ -rm "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
+ -rm "$(DESTDIR)$(PREFIX)$(BINCLASS)/Adjbacklight.class"
+ -rm "$(DESTDIR)$(PREFIX)$(DATA)$(LICENSES)/$(PKGNAME)/COPYING"
+ -rm "$(DESTDIR)$(PREFIX)$(DATA)$(LICENSES)/$(PKGNAME)/LICENSE"
+ -rmdir "$(DESTDIR)$(PREFIX)$(DATA)$(LICENSES)/$(PKGNAME)"
+ -rm "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+
# remove files created by `all`
.PHONY: clean
clean:
- -rm -r *.{class,t2d,aux,cp,cps,fn,ky,log,pg,pgs,toc,tp,vr,vrs,op,ops,bak,info,pdf,ps,dvi,gz} 2>/dev/null
+ -rm -r *.{class,t2d,aux,cp,cps,fn,ky,log,pg,pgs,toc,tp,vr,vrs,op,ops,bak,info,pdf,ps,dvi,gz,install} 2>/dev/null