summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3b1b83dcd9d1de51484aa06738d5f519bd463764 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
include config.mk

all: options $(TARGET)

options: 
	@echo Build options:
	@echo CC 				= $(CC)
	@echo CFLAGS 		= $(CFLAGS)
	@echo LDFLAGS 	= $(LDFLAGS)
	@echo CPPFLAGS 	= $(CPPFLAGS)

$(TARGET): $(SUBDIRS:%=%.subdir-make)

%.subdir-make:
	@$(MAKE) $(MFLAGS) -C $*

#@$(MAKE) -C $(SRCDIR)
#@$(MAKE) -C $(UTILDIR)

clean:  $(SUBDIRS:%=%.subdir-clean)

%.subdir-clean:
	@$(MAKE) $(MFLAGS) clean -C $*

install: $(TARGET) install-man install-data
	install -d $(DESTDIR)$(BINDIR)
	install -m 755 $(SRCDIR)/$(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)

install-man: all
	install -d $(DESTDIR)$(MAN1DIR)
	install -m 644 $(DOCDIR)/$(MANFILE) $(DESTDIR)$(MAN1DIR)/$(MANFILE)
	install -d $(DESTDIR)$(MAN7DIR)
	install -m 644 $(APIDIR)/$(MANAPI) $(DESTDIR)$(MAN7DIR)/$(MANAPI)

install-data: all
	@# Lib
	install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBDIR)
	for file in $(LIBDIR)/*; do \
		install -m 644 $$file $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$$file; \
	done
	@# Share
	install -d $(DESTDIR)$(DATADIR)/pixmaps
	install -m 644 $(SHAREDIR)/dwb.png $(DESTDIR)$(DATADIR)/pixmaps/dwb.png
	install -d $(DESTDIR)$(DATADIR)/applications
	install -m 644 $(SHAREDIR)/dwb.desktop $(DESTDIR)$(DATADIR)/applications/dwb.desktop
	@# Hints
	install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(JSDIR)
	install -m 644 $(JSDIR)/$(HINT_SCRIPT) $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(JSDIR)/$(HINT_SCRIPT)
	@# Libjs
	install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBJSDIR)
	for file in $(LIBJSDIR)/*; do \
		install -m 644 $$file $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$$file; \
	done
	@#Extensions
	install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(EXTENSIONDIR)
	for file in $(EXTENSIONDIR)/*; do \
		install -m 644 $$file $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$$file; \
	done

uninstall: uninstall-man uninstall-data
	@echo "Removing executable from $(subst //,/,$(DESTDIR)$(BINDIR))"
	@$(RM) $(DESTDIR)$(BINDIR)/$(TARGET)

uninstall-man: 
	$(RM) $(DESTDIR)$(MAN1DIR)/$(MANFILE)
	$(RM) $(DESTDIR)$(MAN7DIR)/$(MANAPI)

uninstall-data: 
	$(RM) -r $(DESTDIR)$(DATADIR)/$(REAL_NAME)
	$(RM) -r $(DESTDIR)$(DATADIR)/applications/dwb.desktop
	$(RM) -r $(DESTDIR)$(DATADIR)/pixmaps/dwb.png

distclean: clean

snapshot: 
	@$(MAKE) dist DISTDIR=$(REAL_NAME)-$(BUILDDATE) 

dist: distclean
	@echo "Creating tarball."
	@hg archive -t tgz $(DISTDIR).tar.gz

.PHONY: clean install uninstall distclean install-data install-man uninstall-man uninstall-data phony options