forked from Bill-Gray/PDCursesMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
216 lines (165 loc) · 4.09 KB
/
Makefile
File metadata and controls
216 lines (165 loc) · 4.09 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# GNU MAKE Makefile for PDCurses library for VT
#
# Usage: [g]make [DEBUG=Y] [WIDE=Y] [UTF8=Y] [LIBNAME=(name)]
# [DLLNAME=(name)] [target]
#
# where target can be any of:
# [all|demos|libpdcurses.a|testcurs]...
O = o
ifndef PDCURSES_SRCDIR
PDCURSES_SRCDIR = ..
endif
osdir = $(PDCURSES_SRCDIR)/vt
common = $(PDCURSES_SRCDIR)/common
include $(common)/libobjs.mif
RM = rm -f
# If your system doesn't have these, remove the defines here
SFLAGS = -DHAVE_VSNPRINTF -DHAVE_VSSCANF
CFLAGS = -Wall -Wextra -pedantic -Werror
ifeq ($(DEBUG),Y)
CFLAGS += -g -DPDCDEBUG
else
CFLAGS += -O2
endif
ifeq ($(DOS),Y)
CFLAGS += -DDOS
E = .exe
RM = del
else
CFLAGS += -fPIC
endif
ifeq ($(UTF8),Y)
CFLAGS += -DPDC_FORCE_UTF8
else
ifeq ($(WIDE),Y)
CFLAGS += -DPDC_WIDE
endif
endif
ifdef CHTYPE_32
CFLAGS += -DCHTYPE_32
endif
ifdef _w64
PREFIX = x86_64-w64-mingw32-
E = .exe
endif
ifdef _w32
PREFIX = i686-w64-mingw32-
E = .exe
endif
ifdef _a64
PREFIX = aarch64-w64-mingw32-
E = .exe
endif
ifeq ($(OS),Windows_NT)
E = .exe
RM = cmd /c del
endif
LIBNAME=libpdcurses
DLLNAME=pdcurses
LIBFLAGS = rv
LIBCURSES = $(LIBNAME).a
CC = $(PREFIX)gcc
LIBEXE = $(PREFIX)ar
STRIP = $(PREFIX)strip
ifeq ($(shell uname -s),FreeBSD)
CC = cc
endif
ifeq ($(DLL),Y)
ifeq ($(E),.exe)
CFLAGS += -DPDC_DLL_BUILD
LIBCURSES = $(DLLNAME).dll
LIBEXE = $(CC)
LIBFLAGS = -Wl,--out-implib,$(LIBNAME).a -shared -o
else
ifeq ($(shell uname -s),Darwin)
DLL_SUFFIX = .dylib
else
DLL_SUFFIX = .so
endif
LIBEXE = $(CC)
LIBFLAGS = -shared -o
LIBCURSES = lib$(DLLNAME)$(DLL_SUFFIX)
endif
endif
BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR)
LINK = $(CC)
LDFLAGS = $(LIBCURSES)
RANLIB = $(PREFIX)ranlib
.PHONY: all libs clean demos
all: libs
libs: $(LIBCURSES)
clean:
-$(RM) *.o trace $(LIBCURSES) $(DEMOS)
demos: libs $(DEMOS)
ifneq ($(DEBUG),Y)
$(STRIP) $(DEMOS)
endif
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
$(LIBEXE) $(LIBFLAGS) $@ $?
ifeq ($(LIBCURSES),$(LIBNAME).a)
-$(RANLIB) $@
endif
$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
tui.o tuidemo.o : $(PDCURSES_CURSES_H)
terminfo.o : $(TERM_HEADER)
panel.o ptest: $(PANEL_HEADER)
$(LIBOBJS) : %.o: $(srcdir)/%.c
$(BUILD) $(SFLAGS) -c $<
$(PDCOBJS) : %.o: $(osdir)/%.c
$(BUILD) $(SFLAGS) -c $<
calendar$(E) : $(demodir)/calendar.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
firework$(E) : $(demodir)/firework.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
init_col$(E) : $(demodir)/init_col.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
mbrot$(E) : $(demodir)/mbrot.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
ozdemo$(E) : $(demodir)/ozdemo.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
newtest$(E) : $(demodir)/newtest.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
picsview$(E) : $(demodir)/picsview.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
ptest$(E) : $(demodir)/ptest.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
rain$(E) : $(demodir)/rain.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
speed$(E) : $(demodir)/speed.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
testcurs$(E) : $(demodir)/testcurs.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
test_pan$(E) : $(demodir)/test_pan.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
tuidemo$(E) : tuidemo.o tui.o
$(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS)
widetest$(E) : $(demodir)/widetest.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
worm$(E) : $(demodir)/worm.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
xmas$(E) : $(demodir)/xmas.c
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
tui.o: $(demodir)/tui.c $(demodir)/tui.h
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c
tuidemo.o: $(demodir)/tuidemo.c
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c
configure :
$(CC) $(CFLAGS) -o config_curses$(E) $(common)/config_curses.c
ifdef PREFIX
wine config_curses$(E) -v -d.. $(CFLAGS)
else
./config_curses$(E) -v -d.. $(CFLAGS)
endif
rm config_curses$(E)
include $(demodir)/nctests.mif
install:
ifneq ($(OS),Windows_NT)
cp lib$(DLLNAME).so /usr/local/lib
ldconfig /usr/local/lib
endif
uninstall:
ifneq ($(OS),Windows_NT)
$(RM) /usr/local/lib/lib$(DLLNAME).so
ldconfig /usr/local/lib
endif