-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
114 lines (84 loc) · 2.69 KB
/
Makefile
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.PHONY: all check install clean
ZEXE = ze
CC = cc
#CC = gcc -std=c11
#CC = clang -fno-color-diagnostics
# Portable C Compiler
#LIBDIR=/usr/local/lib/pcc/x86_64-unknown-linux-gnu/1.2.0.DEVEL/lib
#CC = pcc -D__unix__ -L$(LIBDIR)
# Set this if zlib.h is not in /usr/include
#ZLIBINC=-I/usr/local/include
# Set this if aspell.h is not in /usr/include
#ASPELLINC=-I/usr/local/include
# For pcre
#CFLAGS += -DHAVE_PCRE
#LIBS += -lpcreposix -lpcre
# For HUGE_THREADED
#LIBS += -lpthread
# If you set D=1 on the command line then $(D:1=-g)
# returns -g, else it returns the default (-O2).
D = -O2
CFLAGS += -Wall $(D:1=-g) $(ZLIBINC) $(ASPELLINC)
CFLAGS += -DHAVE_CONFIG_H
# Saves about 20k
#CFLAGS += -DNO_HELP
MAKEFLAGS += --no-print-directory
#LIBS += -lz
#LIBS += -ldl
#LIBS += -ltermcap
ETAGS=`which etags || echo true`
CFILES = bcmds.c bind.c cnames.c comment.c commands.c cursor.c delete.c \
display.c file.c funcs.c getarg.c getfname.c help.c shell.c \
srch.c tags.c term.c vars.c window.c varray.c z.c zgrep.c
LFILES = buff.c bfile.c bmsearch.c mark.c reg.c tinit.c calc.c dbg.c undo.c \
kbd.c hugefile.c
# Not used in Zedit
L1FILES=bsocket.c
LHFILES = buff.h calc.h mark.h reg.h tinit.h keys.h
HFILES = config.h funcs.h proto.h vars.h z.h $(LHFILES)
O := $(CFILES:.c=.o)
L := $(LFILES:.c=.o)
#################
#
# Pretty print - "borrowed" from sparse Makefile
#
V = @
Q = $(V:1=)
QUIET_CC = $(Q:@=@echo ' CC '$@;)
QUIET_LINK = $(Q:@=@echo ' LINK '$@;)
QUIET_AR = $(Q:@=@echo ' AR '$@;)
.c.o:
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
#################
all: fcheck $(ZEXE)
$(ZEXE): $O $L
$(QUIET_LINK)$(CC) -o $@ $O $L $(LIBS)
@$(ETAGS) $(CFILES) $(LFILES) $(HFILES)
fcheck: fcheck.c funcs.c kbd.c varray.c cnames.c bind.c config.h vars.h keys.h
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ fcheck.c $(LIBS)
@./fcheck $(ZLIBINC) $(ASPELLINC)
# This is just to check that no zedit dependencies crept into libbuff.a
main: main.c $(LFILES) $(L1FILES)
@rm -rf tmpdir
@mkdir tmpdir
@cp $+ $(LHFILES) tmpdir
@echo -e "all:\n\t$(CC) -DPGSIZE=1024 -g -o $@ $+" > tmpdir/Makefile
@make -C tmpdir
# Make all c files depend on all .h files
*.o: $(HFILES)
# The second sparse checks just the buffer code
checkit:
@sparse -D__unix__ $(CFLAGS) $(CFILES) $(LFILES) $(L1FILES)
@sparse -D__unix__ $(LFILES) $(L1FILES)
@sparse -D__unix__ fcheck.c
doxy:
doxygen doxygen/Doxyfile
install: all
mkdir -p $(DESTDIR)/bin
install -s $(ZEXE) $(DESTDIR)/bin/z
# mkdir -p $(DESTDIR)/usr/share/zedit
# install -m644 zedit-termcap $(DESTDIR)/usr/share/zedit/termcap
clean:
rm -f *.o $(ZEXE) fcheck main core* TAGS valgrind.out sless
rm -rf doxygen/html tmpdir
@$(MAKE) -C docs clean