1TOPDIR=../
2include $(TOPDIR)Rules.make
3
4ifeq ($(LINUX),1)
5LINUX_OBJ=poutput-vcsa.o poutput-fb.o
6LINUX_LIBS=$(ICONV_LIBS)
7endif
8
9hardware_so=hardware.o freq.o
10sets_so=sets.o
11poutput_so=console.o cp437.o latin1.o poutput-curses.o $(LINUX_OBJ) poutput-keyboard.o pfonts.o poutput.o utf-8.o
12poutput_so_libs=$(ICONV_LIBS)
13ifeq ($(HAVE_X11),1)
14poutput_so+=poutput-x11.o x11-common.o
15poutput_so_libs+=$(X11_LIBS)
16NEED_TTF=1
17endif
18ifeq ($(HAVE_SDL),1)
19poutput_so+=poutput-sdl.o
20poutput_so_libs+=$(SDL_LIBS)
21NEED_TTF=1
22endif
23ifeq ($(HAVE_SDL2),1)
24poutput_so+=poutput-sdl2.o
25poutput_so_libs+=$(SDL2_LIBS)
26NEED_TTF=1
27endif
28
29ifeq ($(NEED_TTF),1)
30poutput_so+=ttf.o poutput-swtext.o poutput-fontengine.o
31poutput_so_libs+=$(FREETYPE2_LIBS)
32endif
33
34ifeq ($(STATIC_BUILD),1)
35all: compat.o err.o framelock.o irq.o timer.o $(hardware_so) $(sets_so) $(poutput_so)
36else
37all: compat.o err.o framelock.o irq.o timer.o hardware$(LIB_SUFFIX) sets$(LIB_SUFFIX) poutput$(LIB_SUFFIX)
38endif
39
40test: compat-test
41	./compat-test.sh
42
43poutput$(LIB_SUFFIX): $(poutput_so)
44	$(CC) $(SHARED_FLAGS) $(LINUX_LIBS) -o $@ $^ $(NCURSES_LIBS) $(poutput_so_libs)
45
46hardware$(LIB_SUFFIX): $(hardware_so)
47	$(CC) $(SHARED_FLAGS) -o $@ $^
48
49sets$(LIB_SUFFIX): $(sets_so)
50	$(CC) $(SHARED_FLAGS) -o $@ $^
51
52clean:
53	rm -f *.o *$(LIB_SUFFIX) compat-test
54
55ifeq ($(STATIC_BUILD),1)
56install:
57uninstall:
58else
59install:
60	$(CP) poutput$(LIB_SUFFIX) "$(DESTDIR)$(LIBDIR)/autoload/12-poutput$(LIB_SUFFIX)"
61	$(CP) sets$(LIB_SUFFIX) "$(DESTDIR)$(LIBDIR)/autoload/10-sets$(LIB_SUFFIX)"
62	$(CP) hardware$(LIB_SUFFIX) "$(DESTDIR)$(LIBDIR)/autoload/10-hardware$(LIB_SUFFIX)"
63
64uninstall:
65	rm -f "$(DESTDIR)$(LIBDIR)/hardware$(LIB_SUFFIX)" "$(DESTDIR)$(LIBDIR)/autoload/12-poutput$(LIB_SUFFIX)" "$(DESTDIR)$(LIBDIR)/autoload/10-sets$(LIB_SUFFIX)" "$(DESTDIR)$(LIBDIR)/autoload/10-hardware$(LIB_SUFFIX)"
66endif
67
68cp437.o: cp437.c cp437.h \
69	../config.h \
70	../types.h \
71	utf-8.h
72	$(CC) $< -o $@ -c
73
74compat-test: compat-test.c \
75	compat.c \
76	compat.h \
77	../config.h \
78	../types.h \
79	../boot/plinkman.h
80	$(CC) $< -o $@
81
82poutput.o: poutput.h poutput.c \
83	../config.h \
84	../types.h \
85	imsrtns.h \
86	pfonts.h
87	$(CC) poutput.c -o $@ -c
88
89poutput-keyboard.o: poutput-keyboard.c \
90	poutput.h \
91	../config.h \
92	../types.h
93	$(CC) poutput-keyboard.c -o $@ -c
94
95timer.o: timer.c timer.h irq.h \
96	../config.h \
97	../types.h \
98	compat.h \
99	imsrtns.h \
100	poll.h
101	$(CC) timer.c -o $@ -c
102
103irq.o: irq.c irq.h \
104	../config.h \
105	../types.h
106	$(CC) irq.c -o $@ -c
107
108latin1.o: latin1.c latin1.h \
109	../config.h \
110	../types.h
111	$(CC) $< -o $@ -c
112
113poutput-curses.o: poutput-curses.c poutput-curses.h \
114	../config.h \
115	../types.h \
116	poutput.h \
117	../boot/console.h \
118	../boot/psetting.h \
119	cp437.h \
120	utf-8.h
121	$(CC) poutput-curses.c -o $@ -c
122
123poutput-vcsa.o: poutput-vcsa.c poutput-vcsa.h \
124	../config.h \
125	../types.h \
126	poutput.h \
127	../boot/console.h \
128	../boot/psetting.h \
129	pfonts.h
130	$(CC) poutput-vcsa.c -o $@ -c
131
132poutput-fb.o: poutput-fb.c poutput-fb.h \
133	../config.h \
134	../types.h \
135	../boot/console.h \
136	poutput.h
137	$(CC) poutput-fb.c -o $@ -c
138
139poutput-fontengine.o: poutput-fontengine.c poutput-fontengine.h \
140	../config.h \
141	../types.h \
142	pfonts.h \
143	cp437.h \
144	ttf.h \
145	utf-8.h
146	$(CC) $< -o $@ -c
147
148poutput-sdl.o: poutput-sdl.c poutput-sdl.h \
149	ttf.h \
150	../config.h \
151	../types.h \
152	../boot/console.h \
153	../boot/psetting.h \
154	framelock.h \
155	poutput.h \
156	poutput-fontengine.h \
157	poutput-swtext.h
158	$(CC) $(SDL_CFLAGS) poutput-sdl.c -o $@ -c
159
160poutput-sdl2.o: poutput-sdl2.c poutput-sdl2.h \
161	ttf.h \
162	../config.h \
163	../types.h \
164	../boot/console.h \
165	../boot/psetting.h \
166	framelock.h \
167	poutput.h \
168	poutput-fontengine.h \
169	poutput-swtext.h
170	$(CC) $(SDL2_CFLAGS) poutput-sdl2.c -o $@ -c
171
172poutput-swtext.o: poutput-swtext.c poutput-swtext.h \
173	framelock.h \
174	latin1.h \
175	pfonts.h \
176	poutput.h \
177	poutput-fontengine.h \
178	utf-8.h \
179	../config.h \
180	../types.h
181	$(CC) $(CFLAGS) $< -o $@ -c
182
183poutput-x11.o: poutput-x11.c poutput-x11.h \
184	../config.h \
185	../types.h \
186	../boot/console.h \
187	../boot/psetting.h \
188	../desktop/opencubicplayer.xpm \
189	framelock.h \
190	poutput.h \
191	poutput-swtext.h \
192	pfonts.h \
193	x11-common.h
194	$(CC) poutput-x11.c -o $@ -c
195
196x11-common.o: x11-common.c x11-common.h \
197	../config.h \
198	../types.h \
199	poutput.h
200	$(CC) x11-common.c -o $@ -c
201
202freq.o: freq.c freq.h imsrtns.h \
203	../config.h \
204	../types.h
205	$(CC) freq.c -o $@ -c
206
207err.o: err.c err.h \
208	../config.h \
209	../types.h
210	$(CC) err.c -o $@ -c
211
212sets.o: sets.c sets.h \
213	../config.h \
214	../types.h \
215	../boot/plinkman.h \
216	../boot/psetting.h \
217	err.h
218	$(CC) sets.c -o $@ -c
219
220hardware.o: hardware.c \
221	../config.h \
222	../types.h \
223	../boot/plinkman.h
224	$(CC) hardware.c -o $@ -c
225
226console.o: console.c \
227	../boot/console.h \
228	../config.h \
229	../boot/psetting.h \
230	../stuff/latin1.h \
231	poutput-curses.h \
232	poutput-fb.h \
233	poutput-sdl.h \
234	poutput-sdl2.h \
235	poutput-x11.h \
236	poutput-vcsa.h \
237	utf-8.h
238	$(CC) console.c -o $@ -c
239
240compat.o: compat.c \
241	../config.h \
242	../types.h \
243	../boot/plinkman.h \
244	compat.h
245	$(CC) compat.c -o $@ -c
246
247pfonts.o: pfonts.c \
248	../config.h \
249	../types.h \
250	pfonts.h
251	$(CC) pfonts.c -o $@ -c
252
253framelock.o: framelock.c framelock.h \
254	../config.h \
255	../types.h \
256	../boot/plinkman.h \
257	../boot/psetting.h \
258	../filesel/pfilesel.h \
259	timer.h \
260	err.h
261	$(CC) framelock.c -o $@ -c
262
263ttf.o: ttf.c ttf.h \
264	utf-8.h
265	$(CC) $< -o $@ -c $(FREETYPE2_CFLAGS) $(FREETYPE2_CFLAGS)
266
267utf-8.o: utf-8.c \
268	../config.h \
269	../types.h \
270	../cpiface/cpiface.h \
271	poutput.h \
272	framelock.h \
273	utf-8.h
274	$(CC) $< -o $@ -c
275