about summary refs log tree commit diff stats
path: root/Makefile
blob: b139b544f91a86994ca125a229540e13ea7ab25a (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
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
# dwm - dynamic window manager
# See LICENSE file for copyright and license details.

include config.mk

SRC = dwm.c
OBJ = ${SRC:.c=.o}

all: options dwm

options:
	@echo dwm build options:
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

.c.o:
	@echo CC $<
	@${CC} -c ${CFLAGS} $<

${OBJ}: config.h config.mk

config.h:
	@echo creating $@ from config.def.h
	@cp config.def.h $@

dwm: ${OBJ}
	@echo CC -o $@
	@${CC} -o $@ ${OBJ} ${LDFLAGS}

clean:
	@echo cleaning
	@rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz

dist: clean
	@echo creating dist tarball
	@mkdir -p dwm-${VERSION}
	@cp -R LICENSE Makefile README config.def.h config.mk \
		dwm.1 ${SRC} dwm-${VERSION}
	@tar -cf dwm-${VERSION}.tar dwm-${VERSION}
	@gzip dwm-${VERSION}.tar
	@rm -rf dwm-${VERSION}

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f dwm ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
	@sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
	@chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/dwm
	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
	@rm -f ${DESTDIR}${MANPREFIX}/man1/dwm.1

.PHONY: all options clean dist install uninstall
lass="p">); } void test_trace_check_multiple_lines_at_once() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; CHECK_TRACE_CONTENTS("", "foobar"); } void test_trace_check_always_finds_empty_lines2() { CHECK_TRACE_CONTENTS("test layer 1", ""); } void test_trace_orders_across_layers() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; trace("test layer 1") << "qux"; CHECK_TRACE_CONTENTS("", "foobarqux"); } void test_trace_orders_across_layers2() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; trace("test layer 1") << "qux"; CHECK_TRACE_CONTENTS("foobarqux"); } void test_trace_checks_ordering_spanning_multiple_layers() { trace("layer1") << "foo"; trace("layer2") << "bar"; trace("layer1") << "qux"; CHECK_TRACE_CONTENTS("layer1: foolayer2: barlayer1: qux"); } void test_trace_segments_within_layers() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; new_trace_frame("test layer 1"); trace("test layer 1") << "qux"; CHECK_TRACE_CONTENTS("test layer 1", "fooqux"); CHECK_TRACE_CONTENTS("test layer 1", 0, "foo"); CHECK_TRACE_DOESNT_CONTAIN("test layer 1", 1, "foo"); } void test_trace_checks_ordering_across_layers_and_frames() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; new_trace_frame("test layer 1"); trace("test layer 1") << "qux"; CHECK_TRACE_CONTENTS("test layer 1/0: footest layer 2: bartest layer 1: qux"); CHECK_TRACE_CONTENTS("test layer 1: footest layer 2: bartest layer 1/1: qux"); } void trace_test_fn(int n) { if (n == 0) return; new_trace_frame("foo"); trace("foo") << "before: " << n; trace_test_fn(n-1); trace("foo") << "after: " << n; } void test_trace_keeps_level_together() { CHECK_TRACE_CONTENTS("foo", ""); trace_test_fn(4); CHECK_TRACE_CONTENTS("foo", 2, "before: 3after: 3"); } void test_trace_supports_multiple_layers() { trace("test layer 1") << "foo"; trace("test layer 2") << "bar"; trace("test layer 1") << "qux"; CHECK_TRACE_CONTENTS("test layer 1,test layer 2", "foobarqux"); } void test_trace_supports_hierarchical_layers() { trace("test layer/a") << "foo"; trace("different layer/c") << "foo 2"; trace("test layer/b") << "bar"; CHECK_TRACE_CONTENTS("test layer/", "foobar"); } void test_trace_supports_count() { trace("test layer 1") << "foo"; trace("test layer 1") << "foo"; CHECK_EQ(trace_count("test layer 1", "foo"), 2); } void test_trace_supports_count2() { trace("test layer 1") << "foo"; trace("test layer 1") << "bar"; CHECK_EQ(trace_count("test layer 1"), 2); } // pending: DUMP tests // pending: readable_contents() adds newline if necessary. // pending: RAISE also prints to stderr. // pending: RAISE doesn't print to stderr if Hide_warnings is set. // pending: RAISE doesn't have to be saved if Hide_warnings is set, just printed. // pending: RAISE prints to stderr if Trace_stream is NULL. // pending: RAISE prints to stderr if Trace_stream is NULL even if Hide_warnings is set. // pending: RAISE << ... die() doesn't die if Hide_warnings is set. // can't check trace because trace methods call 'split' void test_split_returns_at_least_one_elem() { vector<string> result = split("", ","); CHECK_EQ(result.size(), 1); CHECK_EQ(result[0], ""); } void test_split_returns_entire_input_when_no_delim() { vector<string> result = split("abc", ","); CHECK_EQ(result.size(), 1); CHECK_EQ(result[0], "abc"); } void test_split_works() { vector<string> result = split("abc,def", ","); CHECK_EQ(result.size(), 2); CHECK_EQ(result[0], "abc"); CHECK_EQ(result[1], "def"); } void test_split_works2() { vector<string> result = split("abc,def,ghi", ","); CHECK_EQ(result.size(), 3); CHECK_EQ(result[0], "abc"); CHECK_EQ(result[1], "def"); CHECK_EQ(result[2], "ghi"); } void test_split_handles_multichar_delim() { vector<string> result = split("abc,,def,,ghi", ",,"); CHECK_EQ(result.size(), 3); CHECK_EQ(result[0], "abc"); CHECK_EQ(result[1], "def"); CHECK_EQ(result[2], "ghi"); }