-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathMakefile
826 lines (710 loc) · 34.2 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
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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
# Makefile to rebuild Goldeneye 007
### Default target ###
default: colour
### Default Build Options ###
# Version of the game to build
FINAL := YES
VERSION := US
IDO_RECOMP := YES
VERBOSE := 2
# If COMPARE is 1, check the output sha1sum when building 'all', and if fail to match
# then compare ELF sections to known md5 checksums.
# If compare is 2, it will just compare the sha1sum.
COMPARE := 1
## VT100 Codes ##
SAVECURSOR := \0337\033[s
RESTORECURSOR := \0338\033[u
SET_SCROLLREGION = \033[$(1);$(2)r
RESTORESCROLLREGION := \033[r
CURSOR_GOTO = \033[$(1);$(2)H
SET_TEXTATTRIB = \033[$(1)$(if $(2),;$(2))$(if $(3),;$(3))m
BELL := \007
#Attributes
RESTORECOLOUR := \033[m
BOLD := 1
DIM := 2
UNDERSCORE := 4
BLINK := 5
INVERT := 7
HIDDEN := 8
#Colours
FG_BLACK:= 30
FG_MAROON:= 31
FG_GREEN:= 32
FG_OLIVE:= 33
FG_NAVY:= 34
FG_PURPLE:= 35
FG_TEAL:= 36
FG_SILVER:= 37
FG_GRAY:= 90
FG_RED:= 91
FG_LIME:= 92
FG_YELLOW:= 93
FG_BLUE:= 94
FG_VIOLET:= 95
FG_CYAN:= 96
FG_WHITE:= 97
BG_BLACK:= 40
BG_MAROON:= 41
BG_GREEN:= 42
BG_OLIVE:= 43
BG_NAVY:= 44
BG_PURPLE:= 45
BG_TEAL:= 46
BG_SILVER:= 47
BG_GRAY:= 100
BG_RED:= 101
BG_LIME:= 102
BG_YELLOW:= 103
BG_BLUE:= 104
BG_VIOLET:= 105
BG_CYAN:= 106
BG_WHITE:= 107
# define a "newline" variable to be used in make scripts
# use with ${\n}
# https://stackoverflow.com/questions/12528637/how-do-i-execute-each-command-in-a-list
define \n
endef
#end newline.
### Build Functions ###
# Common build print status function
PRINT_STATUS = @echo "$(call SET_TEXTATTRIB,$(FG_GREEN))$(1) $(call SET_TEXTATTRIB,$(FG_OLIVE))$(2)$(call SET_TEXTATTRIB,$(FG_GRAY)) $(if $3, -> $(call SET_TEXTATTRIB,$(FG_NAVY))$(3))$(RESTORECOLOUR)"
# Seperate "constant" drawing from variable drawing to speed up PBar rendering
# draws a box and fills it grey ready for blue bar
SetupProgressBar = \
{ \
str="$(SAVECURSOR)$(call SET_SCROLLREGION,4,0)$(call CURSOR_GOTO,2,999)\033[1J$(call CURSOR_GOTO,1)";\
str=$$str"\033(0lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"; \
str=$$str"\nx$(call SET_TEXTATTRIB,$(BG_GRAY))%78s$(RESTORECOLOUR)x\n"; \
str=$$str"mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj\033(B"; \
str=$$str"$(RESTORECURSOR)"; \
printf $$str ""; \
}
#(call DrawProgressBar,Percent)
# OR
#(call DrawProgressBar,NumberOfItemsDone,TotalNumberOfItems)
# If second param is given, use it to work out a percentage.
# divide the percentage into a 80 char long bar
# paint the whole bar grey
# paint the first half, then text, then second half.
# clear colour codes
DrawProgressBar = \
{ \
$(if $(2), \
if [ "$(1)" -ne "$(2)" ]; \
then \
_pdone=`expr 100 / $(2) \* $(1)`; \
else \
_pdone=100; \
fi \
,_pdone=$(1) \
); \
pdone=`expr $$_pdone \* 74 / 100`; \
pdoneb=0; \
str="$(SAVECURSOR)$(call CURSOR_GOTO,2,2)";\
str=$$str"$(call SET_TEXTATTRIB,$(BOLD),$(FG_WHITE),$(BG_NAVY))" ; \
\
if [ "$$pdone" -lt "36" ]; \
then \
str=$$str"%$${pdone}s"; \
str=$$str"$(call SET_TEXTATTRIB,$(BG_GRAY))";\
pdoneb=`expr 36 - $$pdone`; \
str=$$str"%$${pdoneb}s%3d%%"; \
else \
pdoneb=`expr $$pdone - 36`; \
str=$$str"%1s%35s%3d%%%$${pdoneb}s"; \
fi; \
str=$$str"$(RESTORECURSOR)$(RESTORECOLOUR)"; \
printf $$str "" "" $$_pdone; \
}
# Increment Progress Bar From percentage (1), and increase by 1 every (2) seconds.
# Continue doing so until calling process ends
IncrementProgressBarFromAtRate = \
{ \
i=$(1); \
while [ -d /proc/$$! ] && [ $$i -le 100 ]; do \
$(call DrawProgressBar,$$i); \
i=$$((i+1)); \
sleep $(2); \
done; \
}
# Ask to continue
# (1) Prompt, (2) Do if Yes,
# (3) Do if No [can be blank],
# (4) Do if anything else [can be blank]
# (5) Timeout [can be blank]
ContinuePrompt = \
{ \
echo "$1 [y/n]"; \
$(if $(5), readchr(){ old=$$(stty -g); stty raw -echo min 0 time 30; printf '%s' $$(dd bs=1 count=1 2>/dev/null); stty $$old;}; REPLY=$$(readchr) ,read REPLY ); \
echo $$REPLY; case $$REPLY in \
y|Y) $2;; \
n|N) $3;; \
*) $4;; \
esac; \
}
# Convert AI Print commands from readable strings to byte arrays automatically.
ConvertAIPRINT = sed -E -e ':loop s/PRINT\("(..*?)(.)"/PRINT\("\1",\x27\2\x27/g; tloop; \
s/(PRINT\(.*?)\x27\\\x27,\x27(.)\x27(.*)\)/\1\x27\\\2\x27\3\)/g; \
s/(PRINT\()"(.)"(.*)\)/\1\x27\2\x27\3\)/g; \
s/PRINT\((.*)\)/PRINT\(\1,\x27\\0\x27\,)/g; \
s/PRINT\((.*)\)/AI_PRINT,\1/g'
## More Build Variables (Auto) ##
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
TOOLCHAIN := mips-linux-gnu-
else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
TOOLCHAIN := mips64-linux-gnu-
else
TOOLCHAIN := mips64-elf-
endif
ifeq ($(IDO_RECOMP), NO)
QEMU_IRIX := $(shell which qemu-irix 2>/dev/null)
ifeq (, $(QEMU_IRIX))
$(error Using the IDO compiler requires qemu-irix. Please install qemu-irix package or set the QEMU_IRIX environment variable to the full qemu-irix binary path)
endif
IRIX_ROOT := tools/irix/root
else
IRIX_ROOT := tools/ido5.3_recomp
endif
# other tools
TOOLS_DIR := tools
DATASEG_COMP := $(TOOLS_DIR)/data_compress.sh
RZ_COMP := $(TOOLS_DIR)/1172compress.sh
N64CKSUM := $(TOOLS_DIR)/n64cksum
ifeq ($(VERBOSE), 1)
SHA1SUM = sha1sum
else
SHA1SUM = sha1sum --quiet
endif
ifeq ($(FINAL), YES)
OPTIMIZATION := -O2
LCDEFS :=
CFLAGWARNING :=
else
OPTIMIZATION := -g
LCDEFS := -DDEBUG
CFLAGWARNING :=-fullwarn -wlint
endif
ifeq ($(VERSION), US)
COUNTRYCODE := u
OUTCODE := $(COUNTRYCODE)
LANG := US
LCDEFS := -DVERSION_US -DLANG_US -DREFRESH_NTSC -DLEFTOVERDEBUG -DLEFTOVERSPECTRUM -DBUGFIX_R0 -DBYTEMATCH
ASMDEFS := --defsym VERSION_US=1 --defsym LANG_US=1 --defsym REFRESH_NTSC=1 --defsym LEFTOVERDEBUG=1 --defsym LEFTOVERSPECTRUM=1 --defsym BUGFIX_R0=1 --defsym BYTEMATCH=1
LDFILEOPTS := -DVERSION_$(LANG) -DOUTCODE=$(OUTCODE)
endif
ifeq ($(VERSION), EU)
COUNTRYCODE := e
OUTCODE := $(COUNTRYCODE)
LANG := EU
LCDEFS := -DVERSION_EU -DLANG_EU -DREFRESH_PAL -DBUGFIX_R1 -DBUGFIX_R2 -DBYTEMATCH
ASMDEFS := --defsym VERSION_EU=1 --defsym LANG_EU=1 --defsym REFRESH_PAL=1 --defsym BUGFIX_R1=1 --defsym BUGFIX_R2=1 --defsym BYTEMATCH=1
LDFILEOPTS := -DVERSION_$(LANG) -DOUTCODE=$(OUTCODE)
endif
ifeq ($(VERSION), JP)
COUNTRYCODE := j
OUTCODE := $(COUNTRYCODE)
LANG := JP
LCDEFS := -DVERSION_JP -DLANG_JP -DREFRESH_NTSC -DBUGFIX_R1 -DLEFTOVERDEBUG -DLEFTOVERSPECTRUM -DBYTEMATCH
ASMDEFS := --defsym VERSION_JP=1 --defsym LANG_JP=1 --defsym REFRESH_NTSC=1 --defsym BUGFIX_R1=1 --defsym LEFTOVERDEBUG=1 --defsym LEFTOVERSPECTRUM=1 --defsym BYTEMATCH=1
LDFILEOPTS := -DVERSION_$(LANG) -DOUTCODE=$(OUTCODE)
endif
ifeq ($(VERSION), DEBUG)
COUNTRYCODE := u
OUTCODE := d
LANG := US
LCDEFS := -DVERSION_US -DLANG_US -DREFRESH_NTSC -DLEFTOVERDEBUG -DLEFTOVERSPECTRUM -DBUGFIX_R0 -DDEBUGMENU -DVERSION_DEBUG
ASMDEFS := --defsym VERSION_DEBUG=1 --defsym LANG_US=1 --defsym REFRESH_NTSC=1 --defsym LEFTOVERDEBUG=1 --defsym LEFTOVERSPECTRUM=1 --defsym BUGFIX_R0=1 --defsym DEBUGMENU=1
COMPARE := 0
LDFILEOPTS := -DVERSION_$(LANG) -DOUTCODE=$(OUTCODE)
endif
ifeq ($(VERSION), USB)
COUNTRYCODE := u
OUTCODE := usb
LANG := US
LCDEFS := -DVERSION_US -DLANG_US -DREFRESH_NTSC -DLEFTOVERDEBUG -DLEFTOVERSPECTRUM -DBUGFIX_R0 -DDEBUGMENU -DENABLE_USB
ASMDEFS := --defsym VERSION_US=1 --defsym LANG_US=1 --defsym REFRESH_NTSC=1 --defsym LEFTOVERDEBUG=1 --defsym LEFTOVERSPECTRUM=1 --defsym BUGFIX_R0=1 --defsym DEBUGMENU=1 --defsym ENABLE_USB=1
COMPARE := 0
LDFILEOPTS := -DVERSION_$(LANG) -DOUTCODE=$(OUTCODE) -DENABLE_USB
endif
ALLOWED_VERSIONS := US EU JP DEBUG USB
ALLOWED_COUNTRYCODE := u e j
BUILD_DIR_BASE := build
# BUILD_DIR is the location where all build artifacts are placed
BUILD_DIR := $(BUILD_DIR_BASE)/$(OUTCODE)
include assets/Makefile.obseg
include assets/Makefile.music
BUILD_SUB_DIRS := \
rsp src src/game src/inflate \
src/libultra src/libultra/audio src/libultra/gt src/libultra/gu src/libultra/io \
src/libultra/libc src/libultra/os src/libultra/rg src/libultra/sched src/libultra/sp \
src/libultrare src/libultrare/audio src/libultrare/gt src/libultrare/gu src/libultrare/io \
src/libultrare/libc src/libultrare/os src/libultrare/rg src/libultrare/sched src/libultrare/sp \
assets assets/obseg \
assets/obseg/brief assets/obseg/chr assets/obseg/gun assets/obseg/prop \
assets/obseg/text assets/obseg/bg assets/obseg/setup assets/obseg/setup/$(COUNTRYCODE) assets/obseg/stan \
assets/music assets/ramrom assets/images assets/images/split assets/font \
assets/embedded assets/embedded/skeletons assets/embedded/player_gait_object
# create build directories
$(shell mkdir -p $(BUILD_DIR))
$(foreach subdir,$(BUILD_SUB_DIRS),$(shell mkdir -p $(BUILD_DIR)/$(subdir)))
## Collect Objects ##
APPELF := $(BUILD_DIR)/ge007.$(OUTCODE).elf
APPROM := $(BUILD_DIR)/ge007.$(OUTCODE).z64
APPBIN := $(BUILD_DIR)/ge007.$(OUTCODE).bin
HEADERFILES := $(foreach dir,src,$(wildcard $(dir)/*.s))
HEADEROBJECTS := $(foreach file,$(HEADERFILES),$(BUILD_DIR)/$(file:.s=.o))
RSPCODE := $(foreach dir,rsp,$(wildcard $(dir)/*.s))
RSPOBJECTS := $(foreach file,$(RSPCODE),$(BUILD_DIR)/$(file:.s=.bin))
CODEFILES := $(foreach dir,src,$(wildcard $(dir)/*.c))
CODEOBJECTS := $(foreach file,$(CODEFILES),$(BUILD_DIR)/$(file:.c=.o))
GAMEFILES_C := $(foreach dir,src/game,$(wildcard $(dir)/*.c))
GAMEFILES_S := $(foreach dir,src/game,$(wildcard $(dir)/*.s))
GAMEOBJECTS := $(foreach file,$(GAMEFILES_S),$(BUILD_DIR)/$(file:.s=.o)) \
$(foreach file,$(GAMEFILES_C),$(BUILD_DIR)/$(file:.c=.o))
ASSET_DATAFILES := assets/GlobalImageTable.c assets/animationtable_data.c assets/animationtable_entries.c assets/font_dl.c assets/font_chardataj.c assets/font_chardatae.c assets/rarewarelogo.c
ASSET_DATAOBJECTS := $(foreach file,$(ASSET_DATAFILES),$(BUILD_DIR)/$(file:.c=.o))
ROMFILES2 := assets/romfiles2.s
ROMOBJECTS2 := $(BUILD_DIR)/assets/romfiles2.o
RAMROM_FILES := assets/ramrom/ramrom.s
RAMROM_OBJECTS := $(BUILD_DIR)/assets/ramrom/ramrom.o
FONTFILES_C := $(foreach dir,assets/font,$(wildcard $(dir)/*.c))
FONTOBJECTS := $(foreach file,$(FONTFILES_C),$(BUILD_DIR)/$(file:.c=.o))
MUSIC_FILES := $(foreach dir,assets/music,$(wildcard $(dir)/*.s))
MUSIC_OBJECTS := $(foreach file,$(MUSIC_FILES),$(BUILD_DIR)/$(file:.s=.o))
OBSEG_FILES := assets/obseg/ob_seg.s
OBSEG_OBJECTS := $(BUILD_DIR)/assets/obseg/ob_seg.o
OBSEG_RZ := $(BG_SEG_FILES) $(CHR_RZ_FILES) $(GUN_RZ_FILES) $(PROP_RZ_FILES) $(STAN_RZ_FILES) $(BRIEF_RZ_FILES) $(SETUP_RZ_FILES) $(TEXT_RZ_FILES)
IMAGE_BINS := $(foreach dir,assets/images/split,$(wildcard $(dir)/*.bin))
IMAGE_OBJS := $(foreach file,$(IMAGE_BINS),$(BUILD_DIR)/$(file:.bin=.o))
RZFILES := inflate/inflate.c
RZOBJECTS := $(foreach file,$(RZFILES),$(BUILD_DIR)/src/$(file:.c=.o))
OBJECTS := $(RSPOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) $(OBSEGMENT) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(IMAGE_OBJS)
## Command Line args for builders ##
MIPSISET := -mips2 -32
INCLUDE := -I . -I include -I include/ultra64 -I include/PR -I src -I src/game -I src/inflate
# ignore warnings:
# 609 : The number of arguments in the macro invocation does not match the definition - disabled because CPPLib uses "VarArgs" which wasnt invented till c99
# 649 : Missing member name in structure / union - used for "Inheritance"
# 709 : Incompatible pointer type assignment - could be fixed by casting, but implicit is fine.
# 712 : illegal combination of pointer and integer - could be fixed by casting, but implicit is fine.
# 807 : member cannot be of function or incomplete type - Variable length structs
# 838 : Microsoft extension (unnamed structs) - used for "Inheritance" and member/array call swapping
# 763 : Max Float
WOFF := -woff 609,649,709,712,807,838,763
ifeq ($(IDO_RECOMP), NO)
CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
else
CC := $(IRIX_ROOT)/cc
endif
CFLAGS := -Wab,-r4300_mul -non_shared -Olimit 2000 -G 0 -Xcpluscomm $(CFLAGWARNING) $(WOFF) -signed $(INCLUDE) $(MIPSISET) $(LCDEFS) -DTARGET_N64
LD := $(TOOLCHAIN)ld
LD_SCRIPT := build/ge007.$(OUTCODE).ld
# --no-warn-mismatch is needed to link -mips3 object files (some libultra math) with the regular files compiled with -mips2
LDFLAGS := -T $(LD_SCRIPT) -Map build/ge007.$(OUTCODE).map --no-warn-mismatch
AS := $(TOOLCHAIN)as
ASFLAGS := -march=vr4300 -mabi=32 $(INCLUDE) $(ASMDEFS)
# Use the system installed armips if available. Otherwise use the one provided with this repository.
ifneq (,$(shell which armips 2>/dev/null))
ARMIPS := armips
else
ARMIPS := $(TOOLS_DIR)/armips
endif
ASM_PREPROC := python3 tools/asmpreproc/asm-processor.py
OBJCOPY := $(TOOLCHAIN)objcopy
#Now using cursor commands for better look original was //"\033[5;42;97m%80s\r\n%43s%37s\r\n%80s\007\033[0;0m\n"
# Rsrv Up 3 80 Dn 1 Return Dn 1 Ret 80ch
# Lines Lines ch Line SoL midway Line SoL Bell
PRINTNOMATCH := printf "\n\n\033[3A$(call SET_TEXTATTRIB,$(BLINK),$(BG_MAROON),$(FG_WHITE))%80s\033[1B\r%45s%35s\033[1B\r%80s$(BELL)$(RESTORECOLOUR)$(call SET_TEXTATTRIB,$(FG_RED))\n\n\n" "" "NOT MATCH!" "" ""
PRINTMATCH := printf "\n\n\n\033[3A$(call SET_TEXTATTRIB,$(BLINK),$(BG_GREEN),$(FG_WHITE))%80s\033[1B\r%43s%37s\033[1B\r%80s$(BELL)$(RESTORECOLOUR)\n" "" "MATCH!" "" ""
## Build Recipies ##
# this file references variables defined above: BUILD_DIR, CFLAGWARNING, INCLUDE, LCDEFS
# this file defines $(ULTRAOBJECTS)
include src/libultrare/Makefile.libultrare
all: $(APPROM)
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,100)
endif
ifeq ($(COMPARE),1)
@echo "\n"
# Calculate Checksum if fail Allow overspill Which File failed Quick Check (data) Slow Check (extract .text binary)
@$(SHA1SUM) -c ge007.$(OUTCODE).sha1 || ($(PRINTNOMATCH) && echo "$(SAVECURSOR)$(RESTORESCROLLREGION)$(RESTORECURSOR)\033[2D " && $(call ContinuePrompt,"Do you want to check Source Files?",echo "Please wait while we determine which files are affected..." && $(SHA1SUM) --quiet -c checksums.txt && ./test_files.sh -c -i ge007.$(OUTCODE)-test_basis.csv,,,3) && exit 1)
# Else complete
@$(PRINTMATCH)
endif
ifeq ($(COMPARE),2)
@$(SHA1SUM) -c ge007.$(COUNTRYCODE).sha1
endif
@echo "\n Rom File Generated in Build Directory. \n\n"
.SECONDARY:
$(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) \
$(OBSEG_OBJECTS) $(OBSEG_RZ) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(IMAGE_OBJS) $(MUSIC_RZ_FILES)
ifeq ($(filter clean nuke dataclean help codeclean context cmdbuilder test stanclean setupclean colour print-%,$(MAKECMDGOALS)),)
# Dont print version on "default" since it will be spat out twice
ifneq ($(filter $(VERSION),$(ALLOWED_VERSIONS)),)
#$(info VERSION=$(VERSION))
else
$(error VERSION "$(VERSION)" not supported")
endif
# Make tools if out of date
$(info Building tools...)
DUMMY != make -s -C tools >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to build tools)
endif
$(info Building $(VERSION) ROM...)
endif
# Build RSP
$(BUILD_DIR)/rsp/%.bin: rsp/*.s pb1
$(call PRINT_STATUS,Assembling1:,$<,$@)
$(ARMIPS) -sym $@.sym -strequ CODE_FILE $(BUILD_DIR)/rsp/$*.bin -strequ DATA_FILE $(BUILD_DIR)/rsp/$*_data.bin $<
$(BUILD_DIR)/src/rspboot.o: $(BUILD_DIR)/rsp/rspboot.bin
#Build asm files in root
$(BUILD_DIR)/%.o: src/%.s pb2
$(call PRINT_STATUS,Assembling2:,$<,$@)
$(AS) $(ASFLAGS) -o $@ $<
#Build asm files in src/
$(BUILD_DIR)/src/%.o: src/%.s pb3
$(call PRINT_STATUS,Assembling3:,$<,$@)
$(AS) $(ASFLAGS) -o $@ $<
#Build Images
$(BUILD_DIR)/assets/images/split/%.o: assets/images/split/%.bin pb5
$(call PRINT_STATUS,Compiling5:,$<,$@)
$(LD) -r -b binary $< -o $@
#Compress Obseg
$(BUILD_DIR)/$(OBSEGMENT): $(OBSEG_RZ) $(IMAGE_OBJS) pb6
$(call PRINT_STATUS,Compressing6:,$<,$@)
#Build C files in src/
$(BUILD_DIR)/src/%.o: src/%.c
$(call PRINT_STATUS,Compiling8:,$<,$@)
@if grep -q 'GLOBAL_ASM(' $<; then \
$(ASM_PREPROC) $(OPTIMIZATION) $< | $(CC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPTIMIZATION); \
$(ASM_PREPROC) $(OPTIMIZATION) $< --post-process $@ --assembler "$(AS) $(ASFLAGS)" --asm-prelude tools/asmpreproc/prelude.s; \
else \
$(CC) -c $(CFLAGS) -o $@ $(OPTIMIZATION) $<; \
fi
#Build RamRom
$(BUILD_DIR)/assets/ramrom/%.o: assets/ramrom/%.s pb9
$(call PRINT_STATUS,Assembling9:,$<,$@)
$(AS) $(ASFLAGS) -o $@ $<
#Build fonts
$(BUILD_DIR)/assets/font/%.o: assets/font/%.c pb10
$(call PRINT_STATUS,Compiling10:,$<,$@)
$(CC) -c $(CFLAGS) -o $@ $(OPTIMIZATION) $<
#Build asm files in assets/
$(BUILD_DIR)/assets/%.o: assets/%.s pb11
$(call PRINT_STATUS,Assembling11:,$<,$@)
$(AS) $(ASFLAGS) -o $@ $<
#Build Obseg
$(BUILD_DIR)/assets/obseg/%.o: assets/obseg/%.s $(OBSEG_RZ) pb12
$(call PRINT_STATUS,Assembling12:,$<,$@)
$(AS) $(ASFLAGS) -o $@ $<
#Build C files in assets/
$(BUILD_DIR)/assets/%.o: assets/%.c pb4
$(call PRINT_STATUS,Compiling4:,$<,$@)
ifeq ($(filter-out %setup%,$<),)
$(ConvertAIPRINT) $< | $(CC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPTIMIZATION)
else
$(CC) -c $(CFLAGS) -o $@ $(OPTIMIZATION) $<
endif
#$(BUILD_DIR)/src/random.o: OPTIMIZATION := -O3
#$(BUILD_DIR)/src/random.o: INCLUDE := -I . -I include -I include/PR
#$(BUILD_DIR)/src/random.o: MIPSISET := -mips3 -o32
#$(BUILD_DIR)/src/random.o: src/random.c
# $(CC) -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm $(CFLAGWARNING) -woff 819,820,852,821,838,649 -signed $(INCLUDE) $(MIPSISET) $(LCDEFS) -DTARGET_N64 $(OPTIMIZATION) -o $@ $<
#Link Files
$(APPELF): $(RSPOBJECTS) $(ULTRAOBJECTS) $(HEADEROBJECTS) $(OBSEG_RZ) $(BUILD_DIR)/$(OBSEGMENT) $(MUSIC_RZ_FILES) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) $(ROMOBJECTS) $(ASSET_DATAOBJECTS) $(ROMOBJECTS2) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(OBSEG_OBJECTS) pb14 ge007.ld
cpp $(LDFILEOPTS) -P ge007.ld -o build/ge007.$(OUTCODE).ld
@echo "Linking Files into ELF"
$(LD) $(LDFLAGS) -o $@
$(APPBIN): $(APPELF)
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,98)
endif
@echo "Building ROM"
$(OBJCOPY) $< $@ -O binary --gap-fill=0xff
$(APPROM): $(APPBIN)
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,100)
endif
@echo "Compressing ROM"
$(DATASEG_COMP) $< $(OUTCODE)
@echo "Finalizing ROM"
$(N64CKSUM) $< $@
.PRECIOUS: %.bin %.o
## Phony Recipies - Get Make to do something ##
.PHONY: all default codeclean dataclean clean cmdbuidler test help colour
# Dont declare as phony otherwise make will re-evaluate every build including the recipies assosiated with them - just make sure no file is ever called pbx
# pb1 pb2 pb3 pb4 pb5 pb6 pb7 pb8 pb9 pb10 pb11 pb12 pb13 pb14
setupclean:
rm -f $(APPELF) $(APPROM) $(APPBIN) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(SETUP_BUILD_FILES)
stanclean:
rm -f $(APPELF) $(APPROM) $(APPBIN) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(STAN_BUILD_FILES)
libultraclean:
rm -f $(APPELF) $(APPROM) $(APPBIN) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(ULTRAOBJECTS)
codeclean:
ifeq ($(VERBOSE),1)
rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) $(RSPOBJECTS)
else
@clear
@$(call SetupProgressBar)
@echo "\n\n\nDeleting All Code Binaries Only [Assets will be left from previous compile]"
@rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map
@$(call DrawProgressBar,50)
@rm -f $(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) $(RSPOBJECTS)
@$(call DrawProgressBar,100)
endif
@echo "\033[1J$(RESTORESCROLLREGION)\nCode Binaries Cleared! Make will Re-Build these next time.\n"
dataclean:
rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(OBSEG_OBJECTS) $(OBSEG_RZ) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(IMAGE_OBJS) $(MUSIC_RZ_FILES) \
$(STAN_BUILD_FILES) $(SETUP_BUILD_FILES)
# "Conditionals control what 'make' actually "sees" in the makefile, so they cannot be used to control recipes at the time of execution."
# https://www.gnu.org/software/make/manual/html_node/Conditionals.html
ifeq ($(VERBOSE),1)
clean::
# if this command is modified, make sure to update this in the `nuke` recipe.
rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) \
$(OBSEG_OBJECTS) $(OBSEG_RZ) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(IMAGE_OBJS) $(MUSIC_RZ_FILES) $(RSPOBJECTS) \
$(STAN_BUILD_FILES) $(SETUP_BUILD_FILES)
else
clean::
@clear
@echo "\n\n\nDeleting All Code and Asset Binaries"
@$(call SetupProgressBar)
@rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map & $(call IncrementProgressBarFromAtRate,0,0.125)
@rm -f $(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) & $(call IncrementProgressBarFromAtRate,25,0.125)
@rm -f $(OBSEG_OBJECTS) $(OBSEG_RZ) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) & $(call IncrementProgressBarFromAtRate,50,0.125)
@rm -f $(IMAGE_OBJS) $(MUSIC_RZ_FILES) $(RSPOBJECTS) $(STAN_BUILD_FILES) $(SETUP_BUILD_FILES)& $(call IncrementProgressBarFromAtRate,75,0.125)
@$(call DrawProgressBar,100)
@echo "\033[1J$(RESTORESCROLLREGION)\nAll Code and Asset Binaries Cleared! Make will Re-Build these next time.\n"
endif
nuke:
@echo deleting files specified from make clean ...
@# if this command is modified, update the `clean` recipe above.
rm -f $(APPELF) $(APPROM) $(APPBIN) $(ULTRAOBJECTS) $(BUILD_DIR)/ge007.$(OUTCODE).map \
$(HEADEROBJECTS) $(BOOTOBJECTS) $(CODEOBJECTS) $(GAMEOBJECTS) $(RZOBJECTS) \
$(OBSEG_OBJECTS) $(OBSEG_RZ) $(ROMOBJECTS) $(RAMROM_OBJECTS) $(FONTOBJECTS) $(MUSIC_OBJECTS) $(IMAGE_OBJS) $(MUSIC_RZ_FILES) $(RSPOBJECTS) \
$(STAN_BUILD_FILES) $(SETUP_BUILD_FILES)
@echo
@echo make: deleting build folders and files
$(foreach x,$(ALLOWED_COUNTRYCODE),rm -r -f -d "$(BUILD_DIR_BASE)/$(x)/"${\n})
@echo
@echo make: deleting bin / rsp / asp
rm -r -f -d "bin/"
@echo
@echo make: deleting assets
rm -r -f -d "assets/images/split/"
rm -r -f "assets/music/*.bin" "assets/obseg/bg/*.bin" "assets/obseg/brief/*.bin" "assets/obseg/chr/*.bin" "assets/obseg/gun/*.bin" "assets/obseg/prop/*.bin" "assets/obseg/setup/*.bin" "assets/obseg/setup/e/*.bin" "assets/obseg/setup/u/*.bin" "assets/obseg/setup/j/*.bin" "assets/obseg/stan/*.bin" "assets/obseg/text/*.bin" "assets/obseg/text/e/*.bin" "assets/obseg/text/u/*.bin" "assets/obseg/text/j/*.bin" "assets/ramrom/*.bin" "assets/ramrom/e/*.bin" "assets/ramrom/u/*.bin" "assets/ramrom/j/*.bin"
# 0 4 35 80 80(with colour codes)
help:
@echo "\n\033[1;4mmakefile help$(RESTORECOLOUR)"
@echo ""
@echo " supported targets:"
@echo ""
@echo " all $(call SET_TEXTATTRIB,$(FG_LIME)) Build$(RESTORECOLOUR) all (default)"
@echo " clean $(call SET_TEXTATTRIB,$(FG_RED)) Delete all$(RESTORECOLOUR) known build artifacts"
@echo " nuke $(call SET_TEXTATTRIB,$(FG_RED)) Delete all$(RESTORECOLOUR) files explicitly listed in Makefile (same as make clean),"
@echo " all build output for all versions, any .bin file in assets folders,"
@echo " and asp/rsp bin."
@echo " dataclean $(call SET_TEXTATTRIB,$(FG_RED)) Delete$(RESTORECOLOUR) only asset build artifacts"
@echo " codeclean $(call SET_TEXTATTRIB,$(FG_RED)) Delete$(RESTORECOLOUR) only code (asm, .c) build artifacts"
@echo " libultraclean $(call SET_TEXTATTRIB,$(FG_RED)) Delete$(RESTORECOLOUR) only code (asm, .c) build artifacts "
@echo " from Rare's libultra files"
@echo " stanclean $(call SET_TEXTATTRIB,$(FG_RED)) Delete$(RESTORECOLOUR) only stan build artifacts"
@echo " setupclean $(call SET_TEXTATTRIB,$(FG_RED)) Delete$(RESTORECOLOUR) only setup build artifacts"
@echo " cmdbuidler $(call SET_TEXTATTRIB,$(FG_LIME)) Build$(RESTORECOLOUR) AI Commands"
@echo " context [file] $(call SET_TEXTATTRIB,$(FG_LIME)) Build$(RESTORECOLOUR) Context File from [file]"
@echo " eg make context src/game/chrai.c"
@echo " test Re-Run Data Verification "
@echo ""
@echo ""
@echo " options:"
@echo ""
@echo " VERSION=v Region version. (US is default)"
@echo " Supported values: ${ALLOWED_VERSIONS}\n"
#CMD Builder tools
AI_CMD_BUILDER := $(TOOLS_DIR)/cmdbuilder.c
AI_CMD_LIST_DEFINITIONS := src/aicommands.def
AI_CMD_LIST_TEMP := $(BUILD_DIR)/aicommands.temp
AI_CMD_LIST_H2 := src/aicommands2.h
#Pre-Format encoding newlines and tags
AI_CMD_BUILDER_PRECONVERT := sed -E
AI_CMD_BUILDER_PRECONVERT += -e 's/\x27\\n\x27/\x27\/n\x27/g;' # encode '\n' as '/n' (TEXT PRINT command)
AI_CMD_BUILDER_PRECONVERT += -e '/^\s*\*/ s/\x27/\?\?x27/g;' # encode DocBlock(/**...**/) quotes '' as x27
AI_CMD_BUILDER_PRECONVERT += -e '/\/\*\*/ , /\*\// s/([^/])$$/\1 \\n\\/g;' # encode DocBlock(/**...**/) Newlines as \n\ .
#AI_CMD_BUILDER_PRECONVERT += -e '/^\s*\*/ s/([^\/])$$/\1 \\n\\/g;' # encode DocBlock(/**...**/) Newlines as \n\ .
AI_CMD_BUILDER_PRECONVERT += -e 's/[^/\*\S]\*$$/\\n\\/g; s/^(\s*)\*[^/\*]/\1 /g;' # remove DocBlock sides (causes problems with tooltips) fixed to check for ordinary comment
#AI_CMD_BUILDER_PRECONVERT += -e '/^_AI_CMD_POLYMORPH\(CMDNAME,\n(.|\n)*?\s{19}DESCRIPTION(\)| DESCRIPTION2\))/ s/[^,]\n/\\n\\/g;' # Newlines in POLYMORPHS
AI_CMD_BUILDER_PRECONVERT += -e 's/\/\*\*/\?\?\\\*\(\*\*/g;' # encode /** as ??\*(**
AI_CMD_BUILDER_PRECONVERT += -e 's/\*\*\//\*\*\)\*\?\?\\ /g;' # encode **/ as **)*??\
#Format Newlines and Comment tags
AI_CMD_BUILDER_CONVERT := sed -E
AI_CMD_BUILDER_CONVERT += -e 's/\\n/\n/g;' # add newlines
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}\=/\#/g;' # replace ??= with hash for defines
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}\\/\//g;' # replace ??\ with /
AI_CMD_BUILDER_CONVERT += -e 's/DEFINE([^D])/\#define\1/g;' # replace DEFINE with #define
AI_CMD_BUILDER_CONVERT += -e 's/\\.*/\\/g;' # replace \... with \ (line continuation)
AI_CMD_BUILDER_CONVERT += -e 's/\*\(\*/\*/g;' # replace *(* with *
AI_CMD_BUILDER_CONVERT += -e 's/\*\)\*/\*/g;' # replace *)* with *
AI_CMD_BUILDER_CONVERT += -e 's/MAKE_EXPAND\(([^\n]*)MAKE_EXPAND_END\)/\1/g;' #replace MAKE_EXPAND(CONTENTS) with CONTENTS
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}x27/\x27/g;' # replace ??x27 with '
AI_CMD_BUILDER_CONVERT += -e 's/\x27\/n\x27/\x27\\n\x27/g;' # replace '/n' with '\n'
AI_CMD_BUILDER_CONVERT += -e 's/AI_EndList\s*,/AI_EndList/g;' # replace AI_EndList , with AI_EndList
AI_CMD_BUILDER_CONVERT += -e '/^ *$$/d'
AI_CMD_LIST_H2_HEADER := \
"/******************************************************************************\n\
* *\n\
* *\n\
* Do not edit this file. It was automatically generated by \"cmdbuilder\" *\n\
* from the file \"$(AI_CMD_LIST_DEFINITIONS)\". *\n\
* To Add/Remove/Modify AI Commands please edit \"$(AI_CMD_LIST_DEFINITIONS)\" *\n\
* and then run *\n\
* make cmdbuilder *\n\
* *\n\
* *\n\
*****************************************************************************/\n\n"
cmdbuilder:
@clear
@echo
@echo Building AI Command Macros...
@echo
@$(call SetupProgressBar)
@$(call DrawProgressBar,0)
@ # copy command definitions to temp
@cp $(AI_CMD_LIST_DEFINITIONS) $(AI_CMD_LIST_TEMP)
@$(call DrawProgressBar,5)
@ # Preformat Definitions for builder (encode documentation tags)
@$(call PRINT_STATUS,"Pre Formatting",$(AI_CMD_LIST_DEFINITIONS))
@$(AI_CMD_BUILDER_PRECONVERT) $(AI_CMD_LIST_TEMP) > $(AI_CMD_LIST_DEFINITIONS)
@$(call DrawProgressBar,10)
@ # Print Header
@echo $(AI_CMD_LIST_H2_HEADER) > $(AI_CMD_LIST_H2)
@$(call DrawProgressBar,11)
@ # Execute Builder and format (re-add newlines, documentation tags etc) -C keeps /**/ comments
@$(call PRINT_STATUS,"Processing",$(AI_CMD_LIST_DEFINITIONS))
@echo This might take some time...
@$(CC) -Xcpluscomm -c $(AI_CMD_BUILDER) $(INCLUDE) -w 581 -E | $(AI_CMD_BUILDER_CONVERT) >> $(AI_CMD_LIST_H2) & $(call IncrementProgressBarFromAtRate,12,0.5)
@$(call DrawProgressBar,98)
@ # restore command def from temp (no encoding)
@cp $(AI_CMD_LIST_TEMP) $(AI_CMD_LIST_DEFINITIONS)
@$(call DrawProgressBar,99)
@rm $(AI_CMD_LIST_TEMP)
@$(call DrawProgressBar,100)
@echo
@echo Done!
@echo
@echo Rebuild AI Command Macros whenever changing aicommands.def.
@echo "\n$(BELL)$(SAVECURSOR)$(RESTORESCROLLREGION)$(RESTORECURSOR)\033[1A"
test:
@$(SHA1SUM) --quiet -c checksums.txt
@printf "\033[1;92m All Checked Files Match\033[0m\n\n"
# @$(SHA1SUM) $(BG__SEG_FILES) $(BRIEF_RZ_FILES) $(CHR_RZ_FILES) $(GUN_RZ_FILES) \
$(PROP_RZ_FILES) $(SETUP_BIN_FILES) $(STAN_RZ_FILES) $(TEXT_RZ_FILES) > checksums.txt
ifneq ($(filter-out context,$(MAKECMDGOALS)),)
CONTEXTFILE := $(filter-out context ,$(MAKECMDGOALS))
else
CONTEXTFILE := build/ctx.c
endif
context:
@clear
@echo Building Context File [ctx.h] from $(CONTEXTFILE)
@echo "#define TRUE 1" > build/ctx.h
@echo "#define FALSE 0" >> build/ctx.h
ifeq ($(CONTEXTFILE),build/ctx.c)
@echo "#include <bondtypes.h>" > build/ctx.c
endif
@sed -n -E ':x /\\$$/ { N; s/\\\n//g ; bx };''/(^\s*#define)|(\\$$)/p; /(\\$$)/p;' src/bondconstants.h src/bondtypes.h $(CONTEXTFILE) >> build/ctx.h
@$(CC) -c $(CFLAGS) $(CONTEXTFILE) -E > build/ctx2.h 2> /dev/null || (rm build/ctx2.h && exit 1)
@sed -E '/^\s*$$/d' build/ctx2.h >> build/ctx.h
@rm build/ctx.c build/ctx2.h || exit 0
@echo You can find it in Build [build/ctx.h].
testPB:
$(call SetupProgressBar)
$(call IncrementProgressBarFromAtRate,0,0.125)
textures:
$(foreach x,$(IMAGE_BINS),tools/mktex/build/tex2png $(x) assets/images/out ${\n})
colour:
@echo "\033[3A"
ifeq ($(VERBOSE),0)
# @clear
@$(call SetupProgressBar)
@$(call DrawProgressBar,0)
endif
@$(MAKE) --no-print-directory all 2>&1 | sed -E \
-e 's/\(\(\x27E\x27\,\x27R\x27\,\x27R\x27\,\x27O\x27\,\x27R\x27,\s?((\x27?,?\s?\x27.)*)\x27,\s?\x27([^x27])\x27\)/((\x27ERROR\x27,\1\3\x27\)/g; :loop s/\(\((\x27ERROR)((\x27?,?\s?\x27.)*),?\s?\x27(.)\x27([^x27]*)\x27\)/((\1\2\5\x27\)/g; tloop; ' \
-e "s/(ERROR:[^\x27]*?\x27)|(^.*[Ee]rror.*)|(Mis-Match in)|(:\sFAILED)/$$(echo "$(call SET_TEXTATTRIB,$(FG_RED))")&$$(echo "$(RESTORECOLOUR)")/g" \
-e "s/^.*[Ww]arning.*/$$(echo "$(call SET_TEXTATTRIB,$(FG_YELLOW))")&$$(echo "$(RESTORECOLOUR)")/g" \
-e "s/^.*(([Bb]uilding)|(:\sOK)|([Ll]inkin)).*/$$(echo "$(call SET_TEXTATTRIB,$(FG_LIME))")&$$(echo "$(RESTORECOLOUR)")/g" \
-e "s/((([^\/]*([^s][^t][^d][^i][^n])\.c)|([^\/]*\.o))\s)/$$(echo "$(call SET_TEXTATTRIB,$(FG_WHITE))")&$$(echo "$(RESTORECOLOUR)")/g"
@echo "$(SAVECURSOR)$(RESTORESCROLLREGION)$(RESTORECURSOR)\033[1A"
# hide output by default, unless this one of the following targets
ifeq ($(filter nuke,$(MAKECMDGOALS)),)
else
ifeq ($(VERBOSE),0)
.SILENT:
endif
endif
## Progress Bar status - call once ##
pb1:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,1,15)
endif
pb2:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,2,15)
endif
pb3:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,3,15)
endif
pb4:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,4,15)
endif
pb5:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,5,15)
endif
pb6:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,6,15)
endif
pb7:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,7,15)
endif
pb8:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,8,15)
endif
pb9:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,9,15)
endif
pb10:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,10,15)
endif
pb11:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,11,15)
endif
pb12:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,12,15)
endif
pb13:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,13,15)
endif
pb14:
ifeq ($(VERBOSE),0)
@$(call DrawProgressBar,14,15)
endif