forked from ghaerr/microwindows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile_nr
More file actions
732 lines (628 loc) · 19.7 KB
/
Copy pathMakefile_nr
File metadata and controls
732 lines (628 loc) · 19.7 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# Microwindows Non-Recursive Makefile for DOS/DJGPP and MinGW
# by Georg Potthast August 2015
# based on makefile by V. Rogachev
#
#call e.g. make -f Makefile_nr ARCH=DOS
# or make -f Makefile_nr clean ARCH=DOS
# or make -f Makefile_nr ARCH=EM
# or make -f Makefile_nr ARCH=X11
# or make -f Makefile_nr ARCH=MIN
EMSCRIPTEN=N
DOS_DJGPP =N
X11 =N
MINGW =N
#convert em to EM
ifeq ($(subst em,EM,$(ARCH)), EM)
EMSCRIPTEN=Y
$(info Compiling for EMSCRIPTEN)
endif
ifeq ($(subst dos,DOS,$(ARCH))), DOS)
DOS_DJGPP=Y
$(info Compiling for DOS DJGPP)
endif
ifeq ($(subst x,X,$(ARCH)), X11)
X11=Y
$(info Compiling for X11)
endif
ifeq ($(subst min,MIN,$(ARCH)), MIN)
MINGW = Y
$(info Compiling for MinGW)
endif
$(info )
#is ARCH empty? - strip removes blanks
ifeq ($(strip $(ARCH)),)
$(info Please enter ARCH as parameter!)
$(info e.g. make -f Makefile_nr ARCH=DOS)
$(info )
#generate error to stop make!
$(patsubst pattern,replacement,text)
endif
# define arch: DOS/DJGPP or MINGW or EMSCRIPTEN or X11 #######################
# export variables for sublevel makefiles
export MW_DIR_SRC CC CFLAGS AS LD AR STRIP HOSTCC HOSTCFLAGS HAVEMSFONTS VESA MINGW DOS_DJGPP SDL1 SDL2 ALLEGRO4 ALLEGRO5 CLIBS EMSCRIPTEN VERBOSE HAVE_FREETYPE_2_SUPPORT SHOWSTUBS X11
# uncomment to build microwin and/or nano-X demos and libraries
MICROWIN=1
NANOX=1
#uncomment to select just a few examples for testing
TESTPROG=1
# network libs location
NETLIBS=
#NETLIBS=-lsocket -lnsl
ifdef ALLEGRO4
LIBALLEGRO= -lalleg #.dll
endif
ifdef ALLEGRO5
LIBALLEGRO= -lallegro #.dll
endif
# for recursive makes into subdirectories
MW_DIR_SRC := $(CURDIR)
MW_DIR_BIN := $(CURDIR)/bin
# set variable to compile with gcc
CC = gcc
AS = as
LD = ld
AR = ar
STRIP = strip
HOSTCC = gcc
HOSTCFLAGS = -I$(MW_DIR_SRC)/include
OPTIMIZE = Y
OPTLEVEL = -O3
ifeq ($(EMSCRIPTEN), Y)
#SDL1 = Y
SDL2 = Y
CC = emcc
#assembler
AS =
LD = emcc
AR = emar
STRIP = strip
HOSTCC = emcc
HOSTCFLAGS = -I$(MW_DIR_SRC)/include
OPTIMIZE = Y
OPTLEVEL = -O3
endif
#enable EPRINTF and DPRINTF statements in code
#or use fprintf(stdout,"foo\n");
DEBUG= N
#show stubs called in nx11
SHOWSTUBS= N
#add -g flag for GDB
GDB= N
#get Make to print full details
VERBOSE= Y
# DJGPP cc flags, includes
ifeq ($(DOS_DJGPP), Y)
INC = -I$(MW_DIR_SRC)/include
endif
ifeq ($(MINGW), Y)
# MINGW cc flags, includes
INC = -I$(MW_DIR_SRC)/include -I/c/MinGW/msys/1.0/local/include/freetype
INC += -I/usr/local/include
endif
ifeq ($(EMSCRIPTEN), Y)
INC += -I$(MW_DIR_SRC)/include
endif
ifeq ($(SDL2), Y)
INC += -s USE_SDL=2 -s USE_ZLIB=1 -s USE_FREETYPE=1 -s TOTAL_MEMORY=67108864 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s WASM=0
INC += -s USE_LIBPNG=1
#INC += -s ASSERTIONS=1
#INC += -s EMTERPRETIFY_ADVISE=1
#WHITELIST = -s EMTERPRETIFY_WHITELIST='["_GrGetNextEventTimeout"]' -s EMTERPRETIFY_WHITELIST='["_GrPeekWaitEvent"]' -s EMTERPRETIFY_WHITELIST='["_GrCheckNextEvent"]'
#WHITELIST += -s EMTERPRETIFY_WHITELIST='["_GrGetTypedEventPred"]' -s EMTERPRETIFY_WHITELIST='["_GetMessage"]' -s EMTERPRETIFY_WHITELIST='["_main"]'
EMTERPRET = -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1
#$(WHITELIST)
#INC += EMTERPRET
#INC += -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1
NANOFONTS = --preload-file $(MW_DIR_SRC)/fonts/truetype@fonts/truetype
#INC += --embed-file $(MW_DIR_SRC)/demos/nanox/ftdemo.txt@/bin/
#INC += -s VERBOSE=1
NX11fonts = --preload-file $(MW_DIR_SRC)/fonts/em-fonts@/usr/share/fonts/truetype
endif
ifeq ($(X11), Y)
INC = -I$(MW_DIR_SRC)/include
#-L/usr/X11R6/lib -lX11
endif
ifeq ($(GDB), Y)
# -g - include debugging information in source code
CFLAGS += $(INC) -Wall -g
else
# -s - removes all symbol table and relocation information
CFLAGS += $(INC)
#-s -L/c/MinGW/msys/1.0/lib
CFLAGS += -Wno-deprecated-declarations
#-Wno-implicit-function-declaration
#CFLAGS += -L/usr/local/lib -L/local/lib
#CFLAGS += -L/c/MinGW/msys/1.0/local/lib -L/c/MinGW/lib
endif
ifeq ($(OPTIMIZE), Y)
ifneq (,$(findstring -O,$(OPTLEVEL)))
# found - comma means: compare empty string with result of findstring,
# which is not empty if -O is found
CFLAGS += $(OPTLEVEL)
else
CFLAGS += -O3
endif
endif
ifeq ($(VERBOSE), Y)
CFLAGS += -v
else
CFLAGS += -s
endif
#MATHLIB
#CLIBS += -lm
ifeq ($(MINGW), Y)
CFLAGS += -DMINGW
#ALLEGRO4 = 1
ALLEGRO5 = 1
endif
ifeq ($(DOS_DJGPP), Y)
CFLAGS += -DDOS_DJGPP=1 -DMSDOS=1
endif
ifeq ($(EMSCRIPTEN), Y)
CFLAGS += -DEMSCRIPTEN=1
endif
ifeq ($(X11), Y)
USE_EXPOSURE = Y
CFLAGS += -DX11=1 -DLINUX=1 -DUNIX=1
endif
CFLAGS += -DHAVE_FILEIO=1 -DMW_FEATURE_IMAGES=1 -DMW_FEATURE_TIMERS=1
CFLAGS += -DHAVE_SIGNAL=0
ifeq ($(DEBUG), Y)
#HAVE_FPRINTF=0 uses Nano-X error function and outputs to STDOUT=SCREEN
CFLAGS += -DHAVE_FPRINTF=1
else
CFLAGS += -DHAVE_FPRINTF=0
endif
#Add defines to CFLAGS variable
# this links the nano-X application
# with the server. This is required, if no network is present,
# or for speed or debugging. This affects the nano-X server only.
# this Makefile supports this option only!
#LINK_APP_INTO_SERVER=Y
#set to one if linking app into server
CFLAGS += -DNONETWORK=1
# Window move algorithms, change for tradeoff between cpu speed and looks
# UPDATEREGIONS paints in update clipping region only for better look and feel
# ERASEMOVE repaints only backgrounds while window dragging, quicker
# XORMOVE moves windows only after button up, quickest
CFLAGS += -DUPDATEREGIONS=1
CFLAGS += -DERASEMOVE=1
#CFLAGS += -DXORMOVE=1
#set to 1 for MS FONTS
#CFLAGS += -DHAVEMSFONTS=1
#needed in devimage.c
CFLAGS += -DHAVE_MMAP=0
#link in window manager - decorate windows and color background
#needed for nanowm and better for nx11
CFLAGS += -DNANOWM=1
#set to 1 for BMP SUPPORT
CFLAGS += -DHAVE_BMP_SUPPORT=1
#set to 1 for GIF SUPPORT
CFLAGS += -DHAVE_GIF_SUPPORT=1
#set to 1 for PNM SUPPORT
CFLAGS += -DHAVE_PNM_SUPPORT=1
#set to 1 for XPM SUPPORT
CFLAGS += -DHAVE_XPM_SUPPORT=1
##set for JPEG support - libjpeg.a
#CFLAGS += -DHAVE_JPEG_SUPPORT=1
#CLIBS += -ljpeg
##set for PNG support - libpng.a + libz.a
CFLAGS += -DHAVE_PNG_SUPPORT=1
ifneq ($(EMSCRIPTEN), Y)
CLIBS += -lpng -lz
endif
##set for TIFF support - libtiff.a
#CFLAGS += -DHAVE_TIFF_SUPPORT=1
#CLIBS += -ltiff
#font support settings
#Do not use the FONT_DIR macros here with MinGW.
#Within the programs these are set to the
#defaults as specified below, however, the
#macros here are not used properly. Run the
#demos from the root directory e.g. bin/fontdemo
#When run from the bin directory you'll need a fonts
#directory within bin.
#With DJGPP the directory is fixed in font_fnt.c,
#font_pcf.c and font_freetype2.c
CFLAGS += -DHAVE_FNT_SUPPORT=1
#CFLAGS += -DFNT_FONT_DIR="fonts/fnt"
#CFLAGS += -DHAVE_PCF_SUPPORT=1
#CFLAGS += -DPCF_FONT_DIR="fonts/pcf"
#need zlib for gz format
#CFLAGS += -DHAVE_PCFGZ_SUPPORT=1
#CLIBS += -lz
HAVE_FREETYPE_2_SUPPORT = Y
CFLAGS += -DHAVE_FREETYPE_2_SUPPORT=1
#CFLAGS += -DFREETYPE_FONT_DIR=\"fonts/truetype\"
CFLAGS += -I/usr/include/freetype2
ifneq ($(EMSCRIPTEN), Y)
CLIBS += -lfreetype -lz
endif
#CFLAGS += -DHAVE_T1LIB_SUPPORT=1
#T1LIB_FONT_DIR = "fonts/type1/"
#CLIBS += -lt1
# SCREEN SETTINGS #########################
# these settings are used if the environment variable NANOSCR is not used
# e.g. NANOSCR=800 600 565 for TRUECOLOR565
ifndef SCREEN_WIDTH
SCREEN_WIDTH=800
#SCREEN_WIDTH=1024
#SCREEN_WIDTH=1400
endif
ifndef SCREEN_HEIGHT
SCREEN_HEIGHT=600
#SCREEN_HEIGHT=768
#SCREEN_HEIGHT=1050
endif
ifndef SCREEN_DEPTH
SCREEN_DEPTH=8
endif
#/* pixel is packed 8 bits 1, 4 or 8 pal index*/
#SCREEN_PIXTYPE = MWPF_PALETTE
#/* pixel is packed 32 bits byte order |B|G|R|A|*/
SCREEN_PIXTYPE = MWPF_TRUECOLORARGB
#/* pixel is packed 32 bits byte order |R|G|B|A|*/
#SCREEN_PIXTYPE = MWPF_TRUECOLORABGR
#/* pixel is packed 24 bits byte order |B|G|R|*/
#SCREEN_PIXTYPE = MWPF_TRUECOLORRGB
#/* pixel is packed 16 bits little endian RGB565*/
# use this making screenshots with snarf
#SCREEN_PIXTYPE = MWPF_TRUECOLOR565
ifdef SCREEN_HEIGHT
CFLAGS += -DSCREEN_HEIGHT=$(SCREEN_HEIGHT)
endif
ifdef SCREEN_WIDTH
CFLAGS += -DSCREEN_WIDTH=$(SCREEN_WIDTH)
endif
ifdef SCREEN_DEPTH
CFLAGS += -DSCREEN_DEPTH=$(SCREEN_DEPTH)
endif
ifdef SCREEN_PIXTYPE
CFLAGS += -DSCREEN_PIXTYPE=$(SCREEN_PIXTYPE)
CFLAGS += -DMWPIXEL_FORMAT=$(SCREEN_PIXTYPE)
endif
# define ALL target ********************************
ifeq ($(DOS_DJGPP), Y)
ALL += clean init
endif
ifeq ($(MINGW), Y)
ALL += clean init
endif
ALL += drivers/libmwdrivers.a fonts/libfonts.a engine/libmwengine.a nanox/libnano-X.a
ifeq ($(EMSCRIPTEN), Y)
ALL += nx11/libNX11.a
ALL += nx11/libPX11.a
else
ALL += nx11/libNX11.a
endif
ifdef MICROWIN
ALL += mwin/libmwin.a
ifneq ($(EMSCRIPTEN), Y)
ALL += mwin/bmp/libimages.a
endif
ifndef TESTPROG
ALL += mwindemos
endif
endif
ifdef NANOX
ifndef TESTPROG
ALL += nanoxdemos
endif
endif
ifdef TESTPROG
ifeq ($(DOS_DJGPP), Y)
ALL += testprog
endif
ifeq ($(MINGW), Y)
ALL += testprog
endif
ifeq ($(EMSCRIPTEN), Y)
ALL += emprog
endif
ifeq ($(X11), Y)
ALL += X11prog
endif
endif
#define LIBS and NANOLIBS variable - CLIBS = common libs **************
ifeq ($(MINGW), Y)
CLIBS += $(LIBALLEGRO)
endif
#drivers/libmwdrivers.a
#CLIBS += -lmwdrivers
#fonts/libfonts.a
#CLIBS += -lfonts
#engine/libmwengine.a
#CLIBS += -lmwengine
#mwin/bmp/libimages.a
#CLIBS += -limages
NANOLIBS = $(CLIBS)
#nanox/libnano-X.a
ifdef NANOX
NANOLIBS += -lnano-X
endif
#mwin/libmwin.a
ifdef MICROWIN
LIBS += -lmwin
endif
LIBS += $(NETLIBS)
CFLAGS += -L$(MW_DIR_SRC)/lib
ifeq ($(X11), Y)
#CFLAGS += -L/usr/X11R6/lib -lX11
CFLAGS += -L/usr/lib -lX11
endif
#define mwin demo programs
MTARGETS1 := mwdemoalpha mwtest mwtest2 mwdemo mwstretch
#MTARGETS1 += mwterm mwmine # not working in DOS
MTARGETS2 := $(addprefix $(MW_DIR_BIN)/,$(MTARGETS1))
MTARGETS := $(addsuffix .exe,$(MTARGETS2))
#define nanox demo programs
NTARGETS1 := landmine world demo-dash hello
NTARGETS1 += snap_ppm demo-monobitmap
NTARGETS1 += demo-tilestipple demo-poly slider demo-arc demo-blit demo-ttfont demo-aafont show_font demo-font
# not working in DOS
ifeq ($(DOS_DJGPP), N)
NTARGETS1 += nxview tux ntetris tux npanel
# tuxchess
# snap_jpg
endif
ifeq ($(X11), N)
NTARGETS1 += nxeyes nxclock demo-grabkey
endif
NTARGETS2 := $(addprefix $(MW_DIR_BIN)/,$(NTARGETS1))
ifeq ($(X11), N)
ifeq ($(EMSCRIPTEN), Y)
NTARGETS := $(addsuffix .html,$(NTARGETS2))
else
NTARGETS := $(addsuffix .exe,$(NTARGETS2))
endif
#X11
else
#no suffix for X11
NTARGETS := $(NTARGETS2)
endif
#####################
all: $(ALL)
# If you dont want to see every executed command ...
ifndef VERBOSE
.SILENT:
endif
.PHONY: init
#make directories for DOS and copy support files for demos to bin directory
init:
-$("shell md lib 2>NUL")
-$("shell md bin 2>NUL")
-$("shell md obj 2>NUL")
-cp -r \
$(MW_DIR_SRC)/demos/nanox/launcher.cnf \
$(MW_DIR_SRC)/images/demos/nanox/world.map \
$(MW_DIR_SRC)/images/demos/nanox/tux.gif \
$(MW_DIR_SRC)/images/demos/nanox/slidebmp.bmp \
$(MW_DIR_SRC)/images/demos/nanox/uponface.ppm \
$(MW_DIR_SRC)/images/demos/nanox/mwlogo.ppm \
$(MW_DIR_SRC)/images/demos/nanox/icons/*.ppm \
$(MW_DIR_SRC)/images/demos/nanox/icons/*.pgm \
$(MW_DIR_SRC)/images/demos/nanox/ftdemo.txt\
$(MW_DIR_SRC)/fonts\
$(MW_DIR_BIN)
#target for mwin API demos
mwindemos: $(MTARGETS)
demos/mwin/%.o: %.c
$(CC) $(CFLAGS) -c $<
$(MW_DIR_BIN)/%.exe: demos/mwin/%.o
echo "compiling $@"
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
#target for nanox API demos
nanoxdemos: $(NTARGETS)
demos/nanox/%.o: %.c
$(CC) $(CFLAGS) -c $<
ifeq ($(EMSCRIPTEN), Y)
$(MW_DIR_BIN)/%.html: demos/nanox/%.o
else
ifeq ($(X11), Y)
$(MW_DIR_BIN)/%: demos/nanox/%.o
else
$(MW_DIR_BIN)/%.exe: demos/nanox/%.o
endif
endif
echo "compiling $@"
$(CC) $(CFLAGS) -o $@ $< $(NANOLIBS)
#target for test programs
testprog:
echo "Compiling testprograms"
$(info )
$(info $(CFLAGS))
$(info )
$(info $(LIBS))
$(info )
# $(CC) $(CFLAGS) -o bin/mwdemoalpha.exe demos/mwin/mwdemoalpha.c $(LIBS)
# $(CC) $(CFLAGS) -o bin/nxview.exe demos/nanox/nxview.c $(NANOLIBS) -lz
$(CC) $(CFLAGS) -o bin/demo-arc.exe demos/nanox/demo-arc.c $(NANOLIBS)
# $(CC) $(CFLAGS) -o bin/demo-grabkey.exe demos/nanox/demo-grabkey.c $(NANOLIBS)
#target for emscripten test programs
emprog:
echo "Compiling testprograms for emscripten"
$(info CFLAGS: $(CFLAGS))
$(info NANOLIBS: $(NANOLIBS))
$(info **************** )
ifdef MICROWIN
$(CC) $(CFLAGS) -o bin/mwdemo.html demos/mwin/mwdemo.c $(LIBS) $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/mwdemo2.html demos/mwin/mwdemo2.c $(LIBS) $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/mwdvetest.html demos/mwin/mwdvetest.c $(LIBS) $(NANOFONTS) --embed-file $(MW_DIR_SRC)/images/demos/mwin/mwdvetest/dveres.res@/this.res $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/mwlistcombo.html demos/mwin/mwlistcombo.c $(LIBS) $(EMTERPRET)
endif
ifdef NANOX
$(CC) $(CFLAGS) -o bin/demo-ttfont.html demos/nanox/demo-ttfont.c lib/libnano-X.a $(NANOFONTS) $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/demo-aafont.html demos/nanox/demo-aafont.c lib/libnano-X.a $(NANOFONTS) --embed-file $(MW_DIR_SRC)/images/demos/nanox/aademo.txt@/bin/ $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/demo-composite.html demos/nanox/demo-composite.c lib/libnano-X.a $(NANOFONTS) --embed-file $(MW_DIR_SRC)/images/demos/nanox/alphademo.png@images/demos/nanox/ $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/demo-agg.html demos/nanox/demo-agg.cpp demos/nanox/agglite.cpp lib/libnano-X.a $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/demo-grabkey.html demos/nanox/demo-grabkey.c lib/libnano-X.a $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/nxeyes.html demos/nanox/nxeyes.c lib/libnano-X.a $(EMTERPRET)
# $(CC) $(CFLAGS) -o bin/demo-arc.html demos/nanox/demo-arc.c lib/libnano-X.a $(EMTERPRET)
# $(CC) $(CFLAGS) -o bin/hello.html demos/nanox/hello.c lib/libnano-X.a $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/xdraw.html contrib/nx11-test/xdraw.c lib/libPX11.a $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/xhello.html contrib/nx11-test/xhello.c lib/libPX11.a $(EMTERPRET)
$(CC) $(CFLAGS) -o bin/xgreen.html contrib/nx11-test/xgreen.c lib/libNX11.a lib/libnano-X.a $(NX11fonts) $(EMTERPRET)
# $(CC) $(CFLAGS) -o bin/xtestarc.html contrib/nx11-test/xtestarc.c lib/libPX11.a $(EMTERPRET)
# $(CC) $(CFLAGS) -o bin/xmouse.html contrib/nx11-test/xmouse.c lib/libPX11.a $(EMTERPRET)
# $(CC) $(CFLAGS) -o bin/williams.html contrib/nx11-test/williams.c lib/libPX11.a $(EMTERPRET)
# strace $(CC) $(CFLAGS) -o bin/xhello.html contrib/nx11-test/xhello.c lib/libNX11.a lib/libnano-X.a >~/microwindows-em/src/strace.log $(EMTERPRET)
endif
X11prog:
echo "Compiling testprograms for X11"
$(info ######### CFLAGS: )
$(info $(CFLAGS))
$(info ######### NANOLIBS: )
$(info $(NANOLIBS))
$(info ######### )
# $(CC) $(CFLAGS) -o bin/arcdemo.html demos/nanox/demo-arc.c $(NANOLIBS)
$(CC) $(CFLAGS) -o bin/arcdemo demos/nanox/demo-arc.c lib/libnano-X.a -L/usr/X11R6/lib -lX11
# -Llib/libnano-X.a
# $(CC) $(CFLAGS) -o bin/demo-grabkey.exe demos/nanox/demo-grabkey.c $(NANOLIBS)
$(CC) $(CFLAGS) -o bin/xgreen contrib/nx11-test/xgreen.c lib/libnano-X.a lib/libNX11.a -L/usr/X11R6/lib -lX11
$(CC) $(CFLAGS) -o bin/xmouse contrib/nx11-test/xmouse.c lib/libPX11.a -L/usr/X11R6/lib -lX11
# $(CC) -Llib -Iinclude -o bin/xmouse nxlib/test/xmouse.c -lz -lfreetype -lz -lX11 -lPX11
##################### clean ###################################
ifeq ($(MINGW), Y)
clean:
echo "Cleaning MinGW files"
-rm obj/mwin/*.o 2>/dev/null
-rm obj/drivers/*.o 2>/dev/null
-rm obj/mwin/winlib/*.o 2>/dev/null
-rm obj/engine/*.o 2>/dev/null
-rm obj/fonts/*.o 2>/dev/null
-rm drivers/*.o 2>/dev/null
-rm mwin/*.o 2>/dev/null
-rm mwin/bmp/*.o 2>/dev/null
-rm mwin/winlib/*.o 2>/dev/null
-rm nanox/*.o 2>/dev/null
-rm fonts/*.o 2>/dev/null
-rm engine/*.o 2>/dev/null
-rm lib/*.a 2>/dev/null
-rm bin/*.exe 2>/dev/null
-rm bin/*.ppm 2>/dev/null
-rm bin/*.pgm 2>/dev/null
# -rm -rf bin/fonts/ 2>/dev/null
-rm mwin/bmp/*.exe 2>/dev/null
-$(MAKE) -C nx11 clean
echo "Cleaned *.o, *.a, and *.exe files"
endif
ifeq ($(DOS_DJGPP), Y)
clean:
echo "Cleaning DOS files"
-del mwin\*.o
-del mwin\bmp\*.o
-del mwin\winlib\*.o
-del fonts\*.o
-del nanox\*.o
-del drivers\*.o
-del engine\*.o
-del lib\*.a
# or demos will not be compiled again
-del bin\*.exe
-del bin\*.ppm
-del bin\*.pgm
# -rm -rf bin\fonts
-del nx11\*.o
-$(MAKE) -C nx11 clean
echo "Cleaned *.o, *.a, and *.exe files"
endif
ifeq ($(EMSCRIPTEN), Y)
clean:
echo "Cleaning EMSCRIPTEN files"
-rm obj/mwin/*.o 2>/dev/null
-rm obj/drivers/*.o 2>/dev/null
-rm obj/mwin/winlib/*.o 2>/dev/null
-rm obj/engine/*.o 2>/dev/null
-rm obj/fonts/*.o 2>/dev/null
-rm drivers/*.o 2>/dev/null
-rm mwin/*.o 2>/dev/null
-rm mwin/bmp/*.o 2>/dev/null
-rm mwin/winlib/*.o 2>/dev/null
-rm nanox/*.o 2>/dev/null
-rm fonts/*.o 2>/dev/null
-rm engine/*.o 2>/dev/null
-rm lib/*.a 2>/dev/null
-rm bin/*.html 2>/dev/null
-rm bin/*.js 2>/dev/null
-rm bin/*.mem 2>/dev/null
-rm bin/*.data 2>/dev/null
-rm bin/*.ppm 2>/dev/null
-rm bin/*.pgm 2>/dev/null
# -rm -rf bin/fonts/ 2>/dev/null
# -rm mwin/bmp/*.exe 2>/dev/null
-rm nx11/*.o 2>/dev/null
echo "Cleaned *.o, *.a, bin/*.html, bin/*.mem and bin/*.js files"
endif
ifeq ($(X11), Y)
clean:
echo "Cleaning X11 files"
-rm obj/mwin/*.o 2>/dev/null
-rm obj/drivers/*.o 2>/dev/null
-rm obj/mwin/winlib/*.o 2>/dev/null
-rm obj/engine/*.o 2>/dev/null
-rm obj/fonts/*.o 2>/dev/null
-rm drivers/*.o 2>/dev/null
-rm mwin/*.o 2>/dev/null
-rm mwin/bmp/*.o 2>/dev/null
-rm mwin/winlib/*.o 2>/dev/null
-rm nanox/*.o 2>/dev/null
-rm fonts/*.o 2>/dev/null
-rm engine/*.o 2>/dev/null
-rm lib/*.a 2>/dev/null
-rm bin/* 2>/dev/null
-rm bin/*.ppm 2>/dev/null
-rm bin/*.pgm 2>/dev/null
# -rm -rf bin/fonts/ 2>/dev/null
# -rm mwin/bmp/*.exe 2>/dev/null
-rm nx11/*.o 2>/dev/null
-$(MAKE) -C nx11 clean
echo "Cleaned *.o, *.a, bin/*.* files"
endif
#there is a file install in the directory - so define as phony
.PHONY: install
ifeq ($(MINGW), Y)
install:
cp lib/*.a /local/lib
cp inc /local/include/mwin
endif
ifeq ($(DOS_DJGPP), Y)
install:
copy lib\*.a \djgpp\lib
copy inc \djgpp\include\mwin
endif
#############################################################################
#targets for libraries - engine,fonts,drivers make just object files, no libs
#using AR these will be merged into libmwin.a and libnano-X.a
nanox/libnano-X.a:
echo "Generating $@"
$(MAKE) -C nanox -f ../contrib/makefiles_nr/Makefile-nanox
#obsolete
#mwin/winlib/libwinlib.a:
# $(MAKE) -C mwin/winlib
mwin/libmwin.a:
echo "Generating $@"
$(MAKE) -C mwin -f ../contrib/makefiles_nr/Makefile-mwin
fonts/libfonts.a:
echo "Generating font object files"
$(MAKE) -C fonts -f ../contrib/makefiles_nr/Makefile-fonts
engine/libmwengine.a:
echo "Generating engine object files"
$(MAKE) -C engine -f ../contrib/makefiles_nr/Makefile-engine
drivers/libmwdrivers.a:
echo "Generating driver object files"
$(MAKE) -C drivers -f ../contrib/makefiles_nr/Makefile-drivers
mwin/bmp/libimages.a:
echo "Generating $@"
$(MAKE) -C mwin/bmp -f ../../contrib/makefiles_nr/Makefile-bmp
nx11/libNX11.a:
echo "Generating $@"
ifeq ($(EMSCRIPTEN), N)
$(MAKE) -C nx11
else
$(MAKE) -C nx11 -f ../contrib/makefiles_nr/Makefile-nx11
endif
#also set nonetwork=0 above - does not work yet
# $(MAKE) -C nanox -f ../contrib/makefiles_nr/Makefile-nanox-bin
nx11/libPX11.a:
echo "Generating $@"
$(MAKE) -C nx11 -f ../contrib/makefiles_nr/Makefile-px11