aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 524c50aeb2888c59e6cab8de5878f3aae238cbd5 (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
.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