summaryrefslogtreecommitdiff
path: root/src/Makefile
blob: 217340a3ac7e0fdb892dc1805fe5feacfedac63e (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
# See COPYING for copyright and license details

include ../config.mk

DEPS=$(patsubst %.o, %.d, $(OBJ))

all: $(TARGET)

$(TARGET): $(OBJ) 
	@echo "$(CC) $@"
	@$(CC) $(OBJ) -o $(TARGET) $(LDFLAGS) 

-include $(OBJ:.o=.d)
-include $(DOBJ:.do=.dd)

%.o: %.c %.h config.h dwb.h tlds.h
	@echo "${CC} $<"
	@$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) 

debug: $(DTARGET)

deps.d: %.c %.h tlds.h 
	@echo "$(CC) -MM $@"
	@$(CC) $(CFLAGS) -MM $< -o $@


%.do: %.c %.h config.h
	@echo "${CC} $<"
	@$(CC) -c -o $@ $< $(DCFLAGS) 

$(DTARGET): $(DOBJ) 
	@echo "$(CC) $@"
	@$(CC) $(DOBJ) -o $(DTARGET) $(LDFLAGS) 

tlds.h: tlds.in mktlds-header
	@echo gen tlds.h
	@./mktlds-header < tlds.in 
	@echo "#ifndef TLDS_H" > $@
	@echo "#define TLDS_H" >> $@
	@echo "static char *TLDS_EFFECTIVE[] = {" >> $@
	@sed '/^\/\//d;/^[[:space:]]*$$/d;s/^/	"/;s/$$/",/' $< >> $@
	@echo "NULL," >> $@
	@echo "};" >> $@
	@echo "#endif" >> $@

domain.o: tlds.h 

domain.do: tlds.h

dependencies: $(DEPS)

deps: 
	$(MAKE) -B dependencies


#
#tlds.h: effective_tld_names.dat
#	@echo gen tlds.h
#	@echo "#ifndef TLDS_H" > $@
#	@echo "#define TLDS_H" >> $@
#	@echo "static char *effective_tlds[] = {" >> $@
#	@sed '/^\/\//d;/^[[:space:]]*$$/d;s/\(.*\)/	"\1",/' $< >> $@
#	@echo -e "\tNULL," >> $@
#	@echo "};" >> $@
#	@echo "#endif" >> $@


cgdb: debug
	cgdb $(DTARGET)

clean:
	$(RM) *.o  *.do $(TARGET) $(DTARGET) *.d
	$(RM) tlds.h

.PHONY: clean all cgdb deps