aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 12fae3d85ae0dccd018d6c4f9ed9c4b11e0069b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.POSIX:

CC=cc
CFLAGS=-O2 -pipe -Wall -Wextra -Wno-unused-parameter
LD_FLAGS=
_CFLAGS=$$(pkg-config --cflags gtk+-3.0) $(CFLAGS)
_LDFLAGS=$$(pkg-config --libs gtk+-3.0) $(LDFLAGS)
DFLAGS_0=
DFLAGS_1=-g
DFLAGS=$(DFLAGS_$(DEBUG))

DESTDIR=
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
APPDIR=$(PREFIX)/share/applications
MANDIR=$(PREFIX)/share/man/man1
SRCDIR=src
DATADIR=data
OBJECTS=$(SRCDIR)/main.o \
		$(SRCDIR)/file.o \
		$(SRCDIR)/image.o \
		$(SRCDIR)/input.o \
		$(SRCDIR)/window.o \
		$(SRCDIR)/option.o \
		$(SRCDIR)/resources.o	

all: qwe

qwe: $(OBJECTS)
	$(CC) $(_LDFLAGS) -o $@ $(OBJECTS)

$(SRCDIR)/resources.c: $(DATADIR)/qwe.gresources.xml $(DATADIR)/qwe.css
	glib-compile-resources $(DATADIR)/qwe.gresources.xml --target=$@ --generate-source

.c.o:
	$(CC) $(_CFLAGS) $(DFLAGS) -c -o $@ $<

clean:
	rm -f $(SRCDIR)/resources.c
	rm -f $(SRCDIR)/*.o 
	rm -f qwe

install: qwe qwe.desktop
	mkdir -p $(DESTDIR)$(BINDIR)
	cp qwe $(DESTDIR)$(BINDIR)/qwe
	chmod 0775 $(DESTDIR)$(BINDIR)/qwe
	mkdir -p $(DESTDIR)$(APPDIR)
	cp qwe.desktop $(DESTDIR)$(APPDIR)/qwe.desktop
	chmod 0664 $(DESTDIR)$(APPDIR)/qwe.desktop
	mkdir -p $(DESTDIR)$(MANDIR)
	cp doc/qwe.1 $(DESTDIR)$(MANDIR)/qwe.1
	chmod 0664 $(DESTDIR)$(MANDIR)/qwe.1

uninstall:
	rm -f $(DESTDIR)$(BINDIR)/qwe
	rm -f $(DESTDIR)$(APPDIR)/qwe.desktop
	rm -f $(DESTDIR)$(MANDIR)/qwe.1

src/file.o: src/file.c src/file.h src/image.h
src/image.o: src/image.c src/image.h src/window.h
src/input.o: src/input.c src/file.h src/image.h src/input.h src/window.h
src/main.o: src/main.c src/file.h src/image.h src/option.h src/window.h
src/option.o: src/option.c src/option.h
src/resources.o: src/resources.c
src/window.o: src/window.c src/file.h src/image.h src/input.h \
	src/option.h src/window.h