summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-17 02:28:57 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-17 02:28:57 +0100
commitde00c7b257af76887889102f32a41c9f858c2094 (patch)
treede41687e61759399db3bf093245bbdf1396ae054 /Makefile
parentwhitespace (diff)
downloadblueshift-de00c7b257af76887889102f32a41c9f858c2094.tar.gz
blueshift-de00c7b257af76887889102f32a41c9f858c2094.tar.bz2
blueshift-de00c7b257af76887889102f32a41c9f858c2094.tar.xz
finish makefile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile72
1 files changed, 68 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index e964aae..c9a895f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,49 @@
-PKGCONFIG = pkg-config
-OPTIMISE = -Og -g
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+PREFIX ?= /usr
+BIN ?= /bin
+LIB ?= /lib
+DATA ?= /share
+BINDIR ?= $(PREFIX)$(BIN)
+LIBDIR ?= $(PREFIX)$(LIB)
+DATADIR ?= $(PREFIX)$(DATA)
+LICENSEDIR ?= $(DATADIR)/licenses
+
+SHEBANG ?= /usr/bin/python3
+COMMAND ?= blueshift
+PKGNAME ?= blueshift
+
+
+PKGCONFIG ?= pkg-config
+OPTIMISE ?= -Og -g
WARN = -Wall -Wextra -pedantic
LIBS = xcb-randr python3
STD = c99
-
FLAGS = $$($(PKGCONFIG) --cflags --libs $(LIBS)) -std=$(STD) $(WARN) $(OPTIMISE) -fPIC
+DATAFILES = 2deg 10deg redshift redshift_old
+
+
.PHONY: all
-all: bin/blueshift_randr.so
+all: command
+
+.PHONY: command
+command: bin/blueshift_randr.so bin/blueshift
+
+
+bin/blueshift.zip: src/*.py
+ @mkdir -p bin
+ cd src && zip ../$@ *.py
+
+bin/blueshift: bin/blueshift.zip
+ echo '#!/usr/bin/python3' > $@
+ cat $< >> $@
+ chmod a+x $@
bin/blueshift_randr.so: obj/blueshift_randr.o obj/blueshift_randr_c.o
@@ -29,6 +64,35 @@ obj/blueshift_randr.c: src/blueshift_randr.pyx
mv src/blueshift_randr.c $@
+.PHONY: install
+install: install-command install-license
+
+.PHONY: install-command
+install-command: bin/blueshift_randr.so bin/blueshift
+ install -dm755 -- "$(DESTDIR)$(BINDIR)"
+ install -m755 bin/blueshift -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ install -dm755 -- "$(DESTDIR)$(LIBDIR)"
+ install -m755 bin/blueshift_randr.so -- "$(DESTDIR)$(LIBDIR)/blueshift_randr.so"
+ install -dm755 -- "$(DESTDIR)$(DATADIR)/$(PKGNAME)"
+ install -m644 -- $(DATAFILES) "$(DESTDIR)$(DATADIR)/$(PKGNAME)"
+
+.PHONY: install-license
+install-license:
+ install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ install -m644 COPYING LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+
+
+.PHONY: uninstall
+uninstall:
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+ -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ -rm -- $(foreach F,$(DATAFILES),"$(DESTDIR)$(DATADIR)/$(PKGNAME)/$(F)")
+ -rmdir -- "$(DESTDIR)$(DATADIR)/$(PKGNAME)"
+ -rm --"$(DESTDIR)$(LIBDIR)/blueshift_randr.so"
+ -rm --"$(DESTDIR)$(BINDIR)/$(COMMAND)"
+
+
.PHONY: all
clean:
-rm -r bin obj src/blueshift_randr.c