about summary refs log tree commit diff stats
path: root/linux/Makefile
blob: b17c5e1cf6b70e8f2ec9905184bb8d685e73f72d (plain) (blame)
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
<
LIBS= gtk+-2.0 webkit-1.0 libsoup-2.4 gnutls gthread-2.0

CFLAGS+= -O2 -Wall -ggdb3 -D_GNU_SOURCE -I. -I.. $(shell pkg-config --cflags $(LIBS))
LDADD+= $(shell pkg-config --libs $(LIBS)) -lbsd -ldl -lgcrypt

PREFIX?= /usr/local
BINDIR?= $(PREFIX)/bin
LIBDIR?= $(PREFIX)/lib
MANDIR?= $(PREFIX)/share/man
RESDIR?= $(PREFIX)/share/xxxterm

SRCS= $(shell ls ../*.c)
SRCS+= linux.c
OBJS= $(SRCS:.c=.o)
DEPS= $(addsuffix .depend, $(OBJS))

CC?= gcc

BUILDVERSION= $(shell sh $(CURDIR)/../buildver.sh)
ifneq ("${BUILDVERSION}", "")
CFLAGS+= -DXXXTERM_BUILDSTR=\"$(BUILDVERSION)\"
endif

all: javascript.h xxxterm

javascript.h: ../js-merge-helper.pl ../hinting.js ../autoscroll.js
	perl ../js-merge-helper.pl ../hinting.js ../input-focus.js \
	../autoscroll.js > javascript.h

xxxterm: $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LDADD)

%.o: %.c
	@echo "Generating $@.depend"
	@$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< | \
	sed 's,^.*\.o[ :]*,$@ $@.depend : ,g' > $@.depend
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<

install: all
	install -m 755 -d $(DESTDIR)$(BINDIR)
	install -m 755 -d $(DESTDIR)$(LIBDIR)
	install -m 755 -d $(DESTDIR)$(MANDIR)/man1
	install -m 755 -d $(DESTDIR)$(RESDIR)
	install -m 755 xxxterm $(DESTDIR)$(BINDIR)
	install -m 644 ../xxxterm.1 $(DESTDIR)$(MANDIR)/man1/xxxterm.1
	install -m 644 ../xxxtermicon16.png $(DESTDIR)$(RESDIR)
	install -m 644 ../xxxtermicon32.png $(DESTDIR)$(RESDIR)
	install -m 644 ../xxxtermicon48.png $(DESTDIR)$(RESDIR)
	install -m 644 ../xxxtermicon64.png $(DESTDIR)$(RESDIR)
	install -m 644 ../xxxtermicon128.png $(DESTDIR)$(RESDIR)
	install -m 644 ../tld-rules $(DESTDIR)$(RESDIR)
	install -m 644 ../style.css $(DESTDIR)$(RESDIR)

uninstall:
	rm -f $(DESTDIR)$(BINDIR)/xxxterm
	rm -f $(DESTDIR)$(MANDIR)/man1/xxxterm.1
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon.png
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon16.png
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon32.png
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon48.png
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon64.png
	rm -f $(DESTDIR)$(RESDIR)/xxxtermicon128.png
	rm -f $(DESTDIR)$(RESDIR)/style.css
	if [ -d $(DESTDIR)$(RESDIR) ]; then rmdir $(DESTDIR)$(RESDIR); fi
clean:
	rm -f xxxterm $(OBJS) $(DEPS)
	rm -f javascript.h


-include $(DEPS)

.PHONY: all install clean