Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
253 lines (223 loc) · 7.08 KB
/
Copy pathmakefile
File metadata and controls
253 lines (223 loc) · 7.08 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
srcdir = .
abs_top_builddir = .
abs_top_srcdir = .
TOP = $(abs_top_builddir)
ATOP = $(abspath $(TOP))
-include Makefile.conf
export prefix
OS = $(shell uname -s)
ifeq ($(OS),Darwin)
SHLIB_EXT = dylib
# /usr/bin/tic can be too old
EXTRA_NC_CONFIGURE_FLAGS = \
--with-tic-path=/usr/local/opt/ncurses/bin/tic \
--with-build-cppflags=-DHAVE_ALLOCA_H=1
else
SHLIB_EXT = so
EXTRA_NC_CONFIGURE_FLAGS =
endif
DJLIBC32 = $(TOP)/lib/libc32_s.a
DJCRT0 = $(TOP)/lib/crt0.elf
DJUCRT0 = $(TOP)/lib/uplt.o
DJ64LIB = $(TOP)/lib/libdj64.*.*.*
DJ64LIBV = $(TOP)/lib/libdj64.*.*
DJ64DEVL = $(TOP)/lib/libdj64.$(SHLIB_EXT)
DJ64LIBS = $(TOP)/lib/libdj64_s.a
DJ32LIBS = $(TOP)/lib/libdj32_s.a
DJELFLOAD = $(TOP)/lib/elfload.com
NC_BUILD = contrib/ncurses/build
NC_BUILD32 = contrib/ncurses/build32
.PHONY: dj64 demos ncurses ncurses32
all: Makefile.conf dj64 ncurses ncurses32
@echo
@echo "Done building. You may need to run \"sudo make install\" now."
@echo "You can first run \"sudo make uninstall\" to purge the prev install."
Makefile.conf config.status: $(abs_top_srcdir)/Makefile.conf.in $(abs_top_srcdir)/configure
$(abs_top_srcdir)/configure
$(abs_top_srcdir)/configure: $(abs_top_srcdir)/configure.ac
cd $(@D) && autoreconf -v -i -I m4
subs:
# New makes have a way to avoid parallel invocation with the use of &:
need = 4.3
ifneq ($(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))),)
$(DJ64DEVL) $(DJ32LIBS) $(DJLIBC32) &: subs
else
.NOTPARALLEL:
$(DJ64DEVL) $(DJ32LIBS) $(DJLIBC32) : subs
endif
$(MAKE) -C src
%.pc: %.pc.in config.status
./config.status
ifeq ($(USE64),1)
DJ64PC = dj64.pc dj64_s.pc
endif
DJ64PC += dj32.pc
dj64: $(DJ64PC) $(DJ64DEVL)
ifeq ($(HOST),SunOS)
CP_FP = cp -f
else
CP_FP = cp -fP
endif
install_dj64:
ifeq ($(USE64),1)
$(INSTALL) -d $(DESTDIR)$(sysroot)/lib
$(INSTALL) -m 0644 $(DJCRT0) $(DESTDIR)$(sysroot)/lib
$(INSTALL) -m 0644 $(DJUCRT0) $(DESTDIR)$(sysroot)/lib
$(INSTALL) -d $(DESTDIR)$(sysroot)/bin
$(INSTALL) -m 0644 $(DJELFLOAD) $(DESTDIR)$(sysroot)/bin
$(INSTALL) -d $(DESTDIR)$(sysroot)/lib64
$(INSTALL) $(DJ64LIB) $(DESTDIR)$(sysroot)/lib64
$(CP_FP) $(DJ64LIBV) $(DESTDIR)$(sysroot)/lib64
$(CP_FP) $(DJ64DEVL) $(DESTDIR)$(sysroot)/lib64
$(INSTALL) -m 0644 $(DJ64LIBS) $(DESTDIR)$(sysroot)/lib64
$(INSTALL) -d $(DESTDIR)$(sysroot)/include
cp -r $(abs_top_srcdir)/include $(DESTDIR)$(sysroot)
$(INSTALL) -d $(DESTDIR)$(sysroot)/share
$(INSTALL) -m 0644 $(abs_top_srcdir)/dj64.mk $(DESTDIR)$(sysroot)/share
$(INSTALL) -d $(DESTDIR)$(datadir)/dj64
$(INSTALL) -m 0644 $(DJCRT0) $(DESTDIR)$(datadir)/dj64
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 0644 dj64.pc $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 0644 dj64_s.pc $(DESTDIR)$(libdir)/pkgconfig
ifeq ($(NCURSES),1)
$(MAKE) -C $(NC_BUILD) install
endif
endif
install: install_dj64 install_demos install32
@echo
uninstall64:
ifeq ($(USE64),1)
ifeq ($(NCURSES),1)
ifneq ($(wildcard $(NC_BUILD)),)
$(MAKE) -C $(NC_BUILD) uninstall
endif
endif
$(RM) -r $(DESTDIR)$(datadir)/dj64
$(RM) -r $(DESTDIR)$(sysroot)
$(RM) $(DESTDIR)$(libdir)/pkgconfig/dj64.pc
$(RM) $(DESTDIR)$(libdir)/pkgconfig/dj64_s.pc
$(MAKE) -C demos src_uninstall
endif
install32:
ifeq ($(USE32),1)
$(INSTALL) -d $(DESTDIR)$(sysroot32)/lib
$(INSTALL) -d $(DESTDIR)$(sysroot32)/lib32
$(INSTALL) -m 0644 $(DJLIBC32) $(DESTDIR)$(sysroot32)/lib
$(INSTALL) -m 0644 $(DJ32LIBS) $(DESTDIR)$(sysroot32)/lib32
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 0644 dj32.pc $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(sysroot32)/include
cp -r $(abs_top_srcdir)/include $(DESTDIR)$(sysroot32)
$(INSTALL) -d $(DESTDIR)$(sysroot32)/share
$(INSTALL) -m 0644 $(abs_top_srcdir)/dj32.mk $(DESTDIR)$(sysroot32)/share
ifeq ($(NCURSES),1)
$(MAKE) -C $(NC_BUILD32) install
endif
endif
uninstall32:
ifeq ($(USE32),1)
ifeq ($(NCURSES),1)
ifneq ($(wildcard $(NC_BUILD32)),)
$(MAKE) -C $(NC_BUILD32) uninstall
endif
endif
$(RM) -r $(DESTDIR)$(sysroot32)
$(RM) $(DESTDIR)$(libdir)/pkgconfig/dj32.pc
endif
uninstall: uninstall64 uninstall32
clean: demos_clean
$(MAKE) -C src clean
$(RM) *.pc
$(RM) -r lib
ifeq ($(NCURSES),1)
$(RM) -r $(NC_BUILD)
$(RM) -r $(NC_BUILD32)
endif
deb:
debuild -i -us -uc -b
rpm:
$(MAKE) clean
rpkg local && $(MAKE) clean >/dev/null
demos:
$(MAKE) -C demos
demos_static:
$(MAKE) -C demos static
demos_djgpp:
$(MAKE) -C demos djgpp
demos_clean:
$(MAKE) -C demos clean
install_demos:
ifeq ($(USE64),1)
$(MAKE) -C demos src_install
endif
ifeq ($(NCURSES),1)
ifeq ($(USE64),1)
L_CPPFLAGS = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=xcppflags --define-variable=dj64prefix=$(abs_top_srcdir) dj64)
L_CFLAGS = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --cflags dj64)
L_LIBS = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --libs-only-L --libs-only-l --define-variable=libdir=$(ATOP)/lib dj64)
R_PREFIX = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=dj64prefix dj64)
R_LIBDIR = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=libdir dj64)
L_LDFLAGS = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --libs-only-other dj64) \
-Wl,-rpath=$(R_LIBDIR) -nostdlib
$(NC_BUILD) $(NC_BUILD32):
mkdir -p $@
$(NC_BUILD)/Makefile: dj64.pc | $(NC_BUILD) $(DJ64DEVL)
cd $(NC_BUILD) && \
CC="$(CC)" \
LD="$(CC)" \
CPPFLAGS="$(L_CPPFLAGS)" \
CFLAGS="$(CFLAGS) $(L_CFLAGS)" \
LIBS="$(L_LIBS)" \
LDFLAGS="$(L_LDFLAGS)" \
$(abs_top_srcdir)/contrib/ncurses/configure --host=$(shell uname -m)-pc-linux-gnu \
--prefix=$(R_PREFIX) \
--libdir=$(R_LIBDIR) \
--without-manpages \
--without-cxx \
--without-ada \
--without-debug \
--with-fallbacks=vt100,ansi,cygwin,linux,djgpp,djgpp203,djgpp204 \
--disable-database \
--without-tests \
--without-progs \
$(EXTRA_NC_CONFIGURE_FLAGS)
ncurses: $(NC_BUILD)/Makefile
$(MAKE) -C $(NC_BUILD)
else
ncurses:
endif
ifeq ($(USE32),1)
L_CPPFLAGS32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=xcppflags --define-variable=dj32prefix=$(abs_top_srcdir) dj32)
L_CFLAGS32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --cflags dj32)
L_LIBS32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --libs-only-L --libs-only-l --define-variable=libdir32=$(ATOP)/lib dj32)
R_PREFIX32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=dj32prefix dj32)
R_LIBDIR32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --variable=libdir32 dj32)
L_LDFLAGS32 = $(shell PKG_CONFIG_PATH=$(ATOP) pkg-config --define-variable=libdir=$(ATOP)/lib --libs-only-other dj32)
$(NC_BUILD32)/Makefile: dj32.pc | $(NC_BUILD32) $(DJ32LIBS)
cd $(NC_BUILD32) && \
CC="$(CC32)" \
CPPFLAGS="$(L_CPPFLAGS32)" \
CFLAGS="$(L_CFLAGS32) $(CROSS_CFLAGS)" \
LIBS="$(L_LIBS32)" \
LDFLAGS="$(L_LDFLAGS32)" \
$(abs_top_srcdir)/contrib/ncurses/configure --host=i686-linux-gnu \
--prefix=$(R_PREFIX32) \
--libdir=$(R_LIBDIR32) \
--without-manpages \
--without-cxx \
--without-ada \
--without-debug \
--with-fallbacks=vt100,ansi,cygwin,linux,djgpp,djgpp203,djgpp204 \
--disable-database \
--without-tests \
--without-progs \
$(EXTRA_NC_CONFIGURE_FLAGS)
ncurses32: $(NC_BUILD32)/Makefile
$(MAKE) -C $(NC_BUILD32)
else
ncurses32:
endif
else
ncurses:
ncurses32:
endif