forked from alperakcan/libmakefile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.lib
1031 lines (845 loc) · 46.6 KB
/
Makefile.lib
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
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Makefile.lib
#
# version : 3.2.3
# copyright : 2002 - 2020 by Alper Akcan
# email : [email protected]
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# Changelog :
#
# 20080622 - target_depends-y fixes
# 20090210 - added c++ support
# 20100223 - depend file do not depend temp directories
# 20100319 - files depends to Makefile located in their folder
# 20100407 - can handle multiple jobs
# 20130325 - added missing targets for host
# 20140721 - cflags per file support
# 20140908 - distribution support
# 20150211 - fix depends
# 20150319 - use Wl,-rpath
# 20160204 - fix depends
# 20160721 - files-y += *.a support
# 20160726 - overload cc
# 20170209 - qt moc support
# 20170401 - add .o as suffix
# 20170407 - depends-y file gen fix
# 20170425 - directory with space fix
# 20170927 - cflags for .c, cxxflags for .cpp
# 20180105 - target.extra-y
# 20180119 - support using source files from outer directories
# 20180121 - qt uic support
# 20180123 - add ./ to includes-y and libriries-y by default
# 20180204 - seemless qt .moc, .ui support
# 20180228 - rename distdir to dist.dir
# 20180718 - fix @.cmd
# 20180723 - use file_cflags-y if exists
# 20180807 - fix circular dependency with complex makefile setup
# 20181017 - fix subdir makeflag passing
# 20190104 - add soname support
# 20190701 - do not override depends-y
# 20190702 - fix depends-y for subdirs
# 20190806 - fix parallel compilation of ${target}_depends-y
# 20200130 - adding install rule
# 20200203 - add 'distclean' target and add uniq to all foreach
#
# Example
# -------
#
# target-y = target1
# target-y += target2
#
# target1_files-y = target_file_shared.c \
# target1_file_2.c \
# target1_file_3.c
# target1_includes-y = ./ \
# /opt/include
# target1_libraries-y = ./ \
# /opt/lib
# target1_cflags-y = -DUSER_DEFINED \
# -O2
# target1_ldflags-y = -luserdefined
#
# target2_files-y = target_file_shared.c \
# target2_file_2.c \
# target2_file_3.c
# target2_includes-y = ./ \
# /opt/include
# target2_libraries-y = ./ \
# /opt/lib
# target2_cflags-y = -DUSER_DEFINED \
# -O2
# target2_ldflags-y = -luserdefined
#
# dist.dir = dist
#
# dist.base = base
#
# dist.bin = target1
#
# include Makefile.lib
#
#
# Overview
# --------
#
# you can have more than one target, just add targets as you wish. you can
# share files among targets, files will be compiled for each target with
# approtiate flags.
#
# in addition targets may depend each other, so if your target depends on
# target.so just add target.so to target's depend list with;
#
# ${target}_depends-y = target.so
#
# targets may also depend to the subdirectories, so target commands will
# not be executed until subdirs commands get executed.
#
# some usefull files are created in make process, for debugging and for speedup
#
# .target/*.d : includes depend information for the file
# .target/*.d.cmd : the command used for generating .d file
# .target/*.o : object for the file
# .target/*.o.cmd : the command used for creating the object
# .target/target[a,so,o] : the target
# .target/target[a,so,o].cmd : the command used for creating the target
# target : the target
#
#
# Available Targets
# -----------------
#
# target-[y,n, ] : a binary target.
# target will be created with $(CC) -o
# target.o-[y,n, ] : an object target.
# target.o will be created with $(LD) -r -o
# target.a-[y,n, ] : a static library target.
# target.a will be created with $(AR)
# target.so-[y,n, ] : a shared library target.
# target.so will be created with $(CC) -o -shared
#
# target.host-[y,n, ] : a binary target.
# target will be created with $(HOSTCC) -o
# target.o.host-[y,n, ] : an object target.
# target.o will be created with $(HOSTLD) -r -o
# target.a.host-[y,n, ] : a static library target.
# target.a will be created with $(HOSTAR)
# target.so.host-[y,n, ] : a shared library target.
# target.so will be created with $(HOSTCC) -o -shared
#
# subdir-[y,n, ] : subdirectory targets are executed with
# $(subdir-y)_makeflags-y $(MAKE) -C $(subdir-y)
#
#
# Available Target Flags
# ----------------------
#
# $(target)_makeflags-[y,n, ] : makeflags for target will be passed to make
# command only for corresponding target.
# $(target)_files-[y,n, ] : files must match *.[cho] pattern. *.[ch] files
# will be exemined with $(CC) -M command to
# generate dependency files (*.d) files. *.[o]
# files will be used only in linking stage. all
# files generated with make command will be
# removed with $(RM) command.
# $(target)_cflags-[y,n, ] : cflags will be added to global $(CFLAGS) for
# corresponding target only.
# $(target)_cxxflags-[y,n, ] : cxxflags will be added to global $(CXXFLAGS)
# for corresponding target only.
# $(target)_${file}_cflags-[y,n, ] : cflags will be added to global $(CFLAGS) for
# corresponding target file only.
# $(target)_${file}_cxxflags-[y,n, ] : cxxflags will be added to global $(CXXFLAGS)
# for corresponding target file only.
# $(target)_includes-[y,n, ] : a '-I' will be added to all words in includes
# flag, and will be used only for corresponding
# target.
# $(target)_libraries-[y,n, ] : a '-L' will be added to all words in libraries
# flag, and will be used only for corresponding
# target.
# $(target)_ldflags-[y,n, ] : ldflags will be added to gloabal $(LDFLAGS) for
# corresponding target only.
# $(target)_depends-[y,n, ] : all words in depends flag will be added to
# prerequisite's list.
#
#
# Distribution Commands
# ---------------------
#
# dist.dir : distribution folder
# dist.base : base folder to be used in $(dist.dir)/{obj,share,include,src}/
#
# dist.src-[y,n ] : files to be copied under $(dist.dir)/src directory
# dist.obj-[y,n ] : files to be copied under $(dist.dir)/obj directory
# dist.lib-[y,n ] : files to be copied under $(dist.dir)/lib directory
# dist.bin-[y,n ] : files to be copied under $(dist.dir)/bin directory
# dist.include-[y,n ] : files to be copied under $(dist.dir)/include directory
#
TOPDIR ?= $(CURDIR)
CC := $(CROSS_COMPILE_PREFIX)gcc $(SYSROOT)
CXX := $(CROSS_COMPILE_PREFIX)g++ $(SYSROOT)
CPP := $(CROSS_COMPILE_PREFIX)cpp $(SYSROOT)
LD := $(CROSS_COMPILE_PREFIX)ld
AR := $(CROSS_COMPILE_PREFIX)ar
RANLIB := $(CROSS_COMPILE_PREFIX)ranlib
STRIP := $(CROSS_COMPILE_PREFIX)strip -sx
OBJCOPY := $(CROSS_COMPILE_PREFIX)objcopy
MOC ?= $(CROSS_COMPILE_PREFIX)moc
UIC ?= $(CROSS_COMPILE_PREFIX)uic
HOSTCC := $(HOST_COMPILE_PREFIX)gcc
HOSTCXX := $(HOST_COMPILE_PREFIX)g++
HOSTCPP := $(HOST_COMPILE_PREFIX)cpp
HOSTLD := $(HOST_COMPILE_PREFIX)ld
HOSTAR := $(HOST_COMPILE_PREFIX)ar
HOSTRANLIB := $(HOST_COMPILE_PREFIX)ranlib
HOSTSTRIP := $(HOST_COMPILE_PREFIX)strip
HOSTOBJCOPY:= $(HOST_COMPILE_PREFIX)objcpy
HOSTMOC ?= $(HOST_COMPILE_PREFIX)moc
HOSTUIC ?= $(HOST_COMPILE_PREFIX)uic
SED := sed
CD := cd
CP := cp -rf
MV := mv
RM := rm -rf
MKDIR := mkdir -p
__CFLAGS := -Wall -Wextra -Werror -pipe -g3 -O2 -fsigned-char -fno-strict-aliasing -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $(CFLAGS) $(EXTRA_CFLAGS)
#__CFLAGS += -Wswitch-enum -Wshadow
#__CFLAGS += -fvisibility=hidden
#__CFLAGS += -fno-math-errno -fno-trapping-math
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
TARGET_MACHINE := $(subst -, ,$(shell $(CC) -dumpmachine 2>/dev/null))
ifneq ($(findstring mingw, $(TARGET_MACHINE)),)
TARGET_OS := WINDOWS
else ifneq ($(findstring apple, $(TARGET_MACHINE)),)
TARGET_OS := MACOS
else ifneq ($(findstring linux, $(TARGET_MACHINE)),)
TARGET_OS := LINUX
else
TARGET_OS := UNKNOWN
endif
ifeq ($(TARGET_OS),WINDOWS)
else ifeq ($(TARGET_OS),MACOS)
override __DARWIN__ = y
override MFLAGS += __DARWIN__=y
__CFLAGS += -D__DARWIN__=1
__CFLAGS += -I/opt/local/include
#__CFLAGS += -fassociative-math -fno-signed-zeros
override LDOPTS += -keep_private_externs
else ifeq ($(TARGET_OS),LINUX)
override __LINUX__ = y
override MFLAGS += __LINUX__=y
__CFLAGS += -D__LINUX__=1
#__CFLAGS += -fassociative-math -fno-signed-zeros
endif
__CXXFLAGS := $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(__CFLAGS)
__LDFLAGS := $(LDFLAGS) $(EXTRA_LDFLAGS)
MAKE := CFLAGS="$(CFLAGS)" EXTRA_CFLAGS="$(EXTRA_CFLAGS)" CXXFLAGS="$(CXXFLAGS)" EXTRA_CXXFLAGS="$(EXTRA_CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)" EXTRA_LDFLAGS="$(EXTRA_LDFLAGS)" TOPDIR='$(TOPDIR)' uname_S=$(uname_S) TARGET_OS=$(TARGET_OS) \
$(MAKE) $(MFLAGS)
all:
ifneq ($(V)$(VERBOSE),)
verbose := ver
Q =
else
verbose := pur
Q = @
MAKE += --no-print-directory
endif
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
pur_objects := $$(subst __UPDIR__/,../,$$@)
pur_objects := $$(if $$(patsubst /%,,$(pur_objects)),$(CURDIR)/$(pur_objects),$(pur_objects))
#pur_objects = $$(subst $(TOPDIR)/,,$$(subst /.$1,/$1,$(CURDIR)/$$@))
#pur_objects = $$(subst .$1/,,$$@)
#
# PUR
#
pur_disp_depend.c = echo " DEP $(pur_objects)"
pur_disp_compile.c = echo " CC $(pur_objects)"
pur_disp_link.c = echo " LINK $(pur_objects)"
pur_disp_link_so.c = echo " LINKSO $(pur_objects)"
pur_disp_depend.cxx = echo " DEP $(pur_objects)"
pur_disp_compile.cxx = echo " CXX $(pur_objects)"
pur_disp_link.cxx = echo " LINK $(pur_objects)"
pur_disp_link_so.cxx = echo " LINKSO $(pur_objects)"
pur_disp_moc.qt = echo " MOC $(pur_objects)"
pur_disp_uic.qt = echo " UIC $(pur_objects)"
pur_disp_depend.m = echo " DEP $(pur_objects)"
pur_disp_compile.m = echo " CC $(pur_objects)"
pur_disp_link.m = echo " LINK $(pur_objects)"
pur_disp_link_so.m = echo " LINKSO $(pur_objects)"
pur_disp_depend.c.host = echo " HOSTDEP $(pur_objects)"
pur_disp_compile.c.host = echo " HOSTCC $(pur_objects)"
pur_disp_link.c.host = echo " HOSTLINK $(pur_objects)"
pur_disp_link_so.c.host = echo " HOSTLINKSO $(pur_objects)"
pur_disp_depend.cxx.host = echo " HOSTDEP $(pur_objects)"
pur_disp_compile.cxx.host = echo " HOSTCXX $(pur_objects)"
pur_disp_link.cxx.host = echo " HOSTLINK $(pur_objects)"
pur_disp_link_so.cxx.host = echo " HOSTLINKSO $(pur_objects)"
pur_disp_moc.qt.host = echo " HOSTMOC $(pur_objects)"
pur_disp_uic.qt.host = echo " HOSTUIC $(pur_objects)"
pur_disp_depend.m.host = echo " HOSTDEP $(pur_objects)"
pur_disp_compile.m.host = echo " HOSTCC $(pur_objects)"
pur_disp_link.m.host = echo " HOSTLINK $(pur_objects)"
pur_disp_link_so.m.host = echo " HOSTLINKSO $(pur_objects)"
pur_disp_ar = echo " AR $(pur_objects)"
pur_disp_ranlib = echo " RANLIB $(pur_objects)"
pur_disp_ld = echo " LD $(pur_objects)"
pur_disp_ld.host = echo " HOSTLD $(pur_objects)"
pur_disp_cp = echo " CP $(pur_objects)"
pur_disp_mkdir = echo " MKDIR $(CURDIR)/$@"
pur_disp_clean = echo " CLEAN $$(subst _clean,,$(pur_objects))"
pur_disp_dist = echo " DIST $(pur_objects)"
pur_disp_distclean = echo " DISTCLEAN $$(subst _distclean,,$(pur_objects))"
pur_disp_print_deps =
#
# VER
#
ver_disp_depend.c = echo "$(subst ",\",$(_cmd_depend.c))"
ver_disp_compile.c = echo "$(subst ",\",$(_cmd_compile.c))"
ver_disp_link.c = echo "$(subst ",\",$(_cmd_link.c))"
ver_disp_link_so.c = echo "$(subst ",\",$(_cmd_link_so.c))"
ver_disp_depend.cxx = echo "$(subst ",\",$(_cmd_depend.cxx))"
ver_disp_compile.cxx = echo "$(subst ",\",$(_cmd_compile.cxx))"
ver_disp_link.cxx = echo "$(subst ",\",$(_cmd_link.cxx))"
ver_disp_link_so.cxx = echo "$(subst ",\",$(_cmd_link_so.cxx))"
ver_disp_moc.qt = echo "$(subst ",\",$(_cmd_moc.qt))"
ver_disp_uic.qt = echo "$(subst ",\",$(_cmd_uic.qt))"
ver_disp_depend.m = echo "$(subst ",\",$(_cmd_depend.m))"
ver_disp_compile.m = echo "$(subst ",\",$(_cmd_compile.m))"
ver_disp_link.m = echo "$(subst ",\",$(_cmd_link.m))"
ver_disp_link_so.m = echo "$(subst ",\",$(_cmd_link_so.m))"
ver_disp_depend.c.host = echo "$(subst ",\",$(_cmd_depend.c.host))"
ver_disp_compile.c.host = echo "$(subst ",\",$(_cmd_compile.c.host))"
ver_disp_link.c.host = echo "$(subst ",\",$(_cmd_link.c.host))"
ver_disp_link_so.c.host = echo "$(subst ",\",$(_cmd_link_so.c.host))"
ver_disp_depend.cxx.host = echo "$(subst ",\",$(_cmd_depend.cxx.host))"
ver_disp_compile.cxx.host = echo "$(subst ",\",$(_cmd_compile.cxx.host))"
ver_disp_link.cxx.host = echo "$(subst ",\",$(_cmd_link.cxx.host))"
ver_disp_link_so.cxx.host = echo "$(subst ",\",$(_cmd_link_so.cxx.host))"
ver_disp_moc.qt.host = echo "$(subst ",\",$(_cmd_moc.qt.host))"
ver_disp_uic.qt.host = echo "$(subst ",\",$(_cmd_uic.qt.host))"
ver_disp_depend.m.host = echo "$(subst ",\",$(_cmd_depend.m.host))"
ver_disp_compile.m.host = echo "$(subst ",\",$(_cmd_compile.m.host))"
ver_disp_link.m.host = echo "$(subst ",\",$(_cmd_link.m.host))"
ver_disp_link_so.m.host = echo "$(subst ",\",$(_cmd_link_so.m.host))"
ver_disp_ar = echo "$(subst ",\",$(_cmd_ar))"
ver_disp_ranlib = echo "$(subst ",\",$(_cmd_ranlib))"
ver_disp_ld = echo "$(subst ",\",$(_cmd_ld))"
ver_disp_ld.host = echo "$(subst ",\",$(_cmd_ld.host))"
ver_disp_cp = echo "$(subst ",\",$(_cmd_cp))"
ver_disp_mkdir = echo "$(subst ",\",$(_cmd_mkdir))"
ver_disp_clean = echo "$(subst ",\",$(_cmd_clean) $1 .$1 [email protected])"
ver_disp_dist = echo "$(subst ",\",$(_cmd_dist))"
ver_disp_distclean = echo "$(subst ",\",$(_cmd_distclean) $1 .$1 [email protected])"
ver_disp_print_deps = echo "Target $$@ depends on prerequisites '$$^'"
#
# DISP
#
disp_depend.c = $($(verbose)_disp_depend.c)
disp_compile.c = $($(verbose)_disp_compile.c)
disp_link.c = $($(verbose)_disp_link.c)
disp_link_so.c = $($(verbose)_disp_link_so.c)
disp_depend.cxx = $($(verbose)_disp_depend.cxx)
disp_compile.cxx = $($(verbose)_disp_compile.cxx)
disp_link.cxx = $($(verbose)_disp_link.cxx)
disp_link_so.cxx = $($(verbose)_disp_link_so.cxx)
disp_moc.qt = $($(verbose)_disp_moc.qt)
disp_uic.qt = $($(verbose)_disp_uic.qt)
disp_depend.m = $($(verbose)_disp_depend.m)
disp_compile.m = $($(verbose)_disp_compile.m)
disp_link.m = $($(verbose)_disp_link.m)
disp_link_so.m = $($(verbose)_disp_link_so.m)
disp_depend.c.host = $($(verbose)_disp_depend.c.host)
disp_compile.c.host = $($(verbose)_disp_compile.c.host)
disp_link.c.host = $($(verbose)_disp_link.c.host)
disp_link_so.c.host = $($(verbose)_disp_link_so.c.host)
disp_depend.cxx.host = $($(verbose)_disp_depend.cxx.host)
disp_compile.cxx.host = $($(verbose)_disp_compile.cxx.host)
disp_link.cxx.host = $($(verbose)_disp_link.cxx.host)
disp_link_so.cxx.host = $($(verbose)_disp_link_so.cxx.host)
disp_moc.qt.host = $($(verbose)_disp_moc.qt.host)
disp_uic.qt.host = $($(verbose)_disp_uic.qt.host)
disp_depend.m.host = $($(verbose)_disp_depend.m.host)
disp_compile.m.host = $($(verbose)_disp_compile.m.host)
disp_link.m.host = $($(verbose)_disp_link.m.host)
disp_link_so.m.host = $($(verbose)_disp_link_so.m.host)
disp_ar = $($(verbose)_disp_ar)
disp_ranlib = $($(verbose)_disp_ranlib)
disp_ld = $($(verbose)_disp_ld)
disp_ld.host = $($(verbose)_disp_ld.host)
disp_cp = $($(verbose)_disp_cp)
disp_mkdir = $($(verbose)_disp_mkdir)
disp_clean = $($(verbose)_disp_clean)
disp_dist = $($(verbose)_disp_dist)
disp_distclean = $($(verbose)_disp_distclean)
disp_print_deps = $($(verbose)_disp_print_deps)
#
# _CMD
#
_cmd_depend.c = $(CC) $(__CFLAGS) $($1_cflags) \
$$($1_$$<_cflags-y) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.c = $(CC) $(__CFLAGS) $($1_cflags) \
$$($1_$$<_cflags-y) $($1_includes) -c -o $$@ $$<
_cmd_link.c = $(CC) $(__CFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.c = $(CC) $(__CFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_depend.c.host = $(HOSTCC) $(__CFLAGS) $($1_cflags) \
$$($1_$$<_cflags-y) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.c.host = $(HOSTCC) $(__CFLAGS) $($1_cflags) \
$$($1_$$<_cflags-y) $($1_includes) -c -o $$@ $$<
_cmd_link.c.host = $(HOSTCC) $(__CFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.c.host = $(HOSTCC) $(__CFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_depend.cxx = $(CXX) $(__CXXFLAGS) $($1_cxxflags) \
$$($1_$$<_cxxflags-y) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.cxx = $(CXX) $(__CXXFLAGS) $($1_cxxflags) \
$$($1_$$<_cxxflags-y) $($1_includes) -c -o $$@ $$<
_cmd_link.cxx = $(CXX) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.cxx = $(CXX) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_depend.cxx.host = $(HOSTCXX) $(__CXXFLAGS) $($1_cxxflags) \
$$($1_$$<_cxxflags-y) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.cxx.host = $(HOSTCXX) $(__CXXFLAGS) $($1_cxxflags) \
$$($1_$$<_cxxflags-y) $($1_includes) -c -o $$@ $$<
_cmd_link.cxx.host = $(HOSTCXX) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.cxx.host = $(HOSTCXX) $(__CXXFLAGS)$($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_moc.qt = $(MOC) $($1_mocflags) $($1_includes) $$< -o $$@
_cmd_moc.qt.host = $(HOSTMOC) $($1_mocflags) $($1_includes) $$< -o $$@
_cmd_uic.qt = $(UIC) $$< -o $$@
_cmd_uic.qt.host = $(HOSTUIC) $$< -o $$@
_cmd_depend.m = $(CC) $(__CXXFLAGS) $($1_cflags) $($1_cxxflags) \
$$($1_$$<_cflags-y) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.m = $(CC) $(__CXXFLAGS) $($1_cflags) $($1_cxxflags) \
$$($1_$$<_cflags-y) $($1_includes) -c -o $$@ $$<
_cmd_link.m = $(CC) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.m = $(CC) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_depend.m.host = $(HOSTCC) $(__CXXFLAGS) $($1_cflags) \
$($1_cxxflags) $($1_includes) -M $$< | $(SED) 's,\($$(basename $$(basename $$(notdir $$@)))\.o\) *:,$$(dir $$@)\1 $$@: ,' > $$@; \
$(CP) $$@ [email protected]; \
$(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$$$//' -e '/^$$$$/ d' -e 's/$$$$/ :/' < $$@ >> [email protected]; \
$(MV) [email protected] $$@
_cmd_compile.m.host = $(HOSTCC) $(__CXXFLAGS) $($1_cflags) \
$($1_cxxflags) $($1_includes) $$($1_$$<_cflags-y) -c -o $$@ $$<
_cmd_link.m.host = $(HOSTCC) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $(__LDFLAGS)
_cmd_link_so.m.host = $(HOSTCC) $(__CXXFLAGS) $($1_libraries) -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^) \
$($1_ldflags) $$(filter-out -static,$(__LDFLAGS)) -shared $$(if $($1_soname-y),-Wl$$(comma)-soname$$(comma)$($1_soname-y),-Wl$$(comma)-soname$$(comma)$$(notdir $$@))
_cmd_ar = $(AR) rcs $$@ $$(filter-out __FORCE $($1_depends_y),$$^)
_cmd_ranlib = $(RANLIB) $$@
_cmd_ld = $(LD) $(LDOPTS) -r -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^)
_cmd_ld.host = $(HOSTLD) $(LDOPTS) -r -o $$@ $$(filter-out __FORCE $($1_depends_y),$$^)
_cmd_cp = $(CP) $$< $$@
_cmd_mkdir = $(MKDIR) $@
_cmd_clean = $(RM)
_cmd_dist = $(CP) $$< $$@
_cmd_distclean = $(RM)
#
# CMD
#
cmd_depend.c = echo "$(subst ",\",$(_cmd_depend.c))" > [email protected] ; $(_cmd_depend.c)
cmd_compile.c = echo "$(subst ",\",$(_cmd_compile.c))" > [email protected] ; $(_cmd_compile.c)
cmd_link.c = echo "$(subst ",\",$(_cmd_link.c))" > [email protected] ; $(_cmd_link.c)
cmd_link_so.c = echo "$(subst ",\",$(_cmd_link_so.c))" > [email protected] ; $(_cmd_link_so.c)
cmd_depend.c.host = echo "$(subst ",\",$(_cmd_depend.c.host))" > [email protected] ; $(_cmd_depend.c.host)
cmd_compile.c.host = echo "$(subst ",\",$(_cmd_compile.c.host))" > [email protected] ; $(_cmd_compile.c.host)
cmd_link.c.host = echo "$(subst ",\",$(_cmd_link.c.host))" > [email protected] ; $(_cmd_link.c.host)
cmd_link_so.c.host = echo "$(subst ",\",$(_cmd_link_so.c.host))" > [email protected] ; $(_cmd_link_so.c.host)
cmd_depend.cxx = echo "$(subst ",\",$(_cmd_depend.cxx))" > [email protected] ; $(_cmd_depend.cxx)
cmd_compile.cxx = echo "$(subst ",\",$(_cmd_compile.cxx))" > [email protected] ; $(_cmd_compile.cxx)
cmd_link.cxx = echo "$(subst ",\",$(_cmd_link.cxx))" > [email protected] ; $(_cmd_link.cxx)
cmd_link_so.cxx = echo "$(subst ",\",$(_cmd_link_so.cxx))" > [email protected] ; $(_cmd_link_so.cxx)
cmd_depend.cxx.host = echo "$(subst ",\",$(_cmd_depend.cxx.host))" > [email protected] ; $(_cmd_depend.cxx.host)
cmd_compile.cxx.host = echo "$(subst ",\",$(_cmd_compile.cxx.host))" > [email protected]; $(_cmd_compile.cxx.host)
cmd_link.cxx.host = echo "$(subst ",\",$(_cmd_link.cxx.host))" > [email protected] ; $(_cmd_link.cxx.host)
cmd_link_so.cxx.host = echo "$(subst ",\",$(_cmd_link_so.cxx.host))" > [email protected]; $(_cmd_link_so.cxx.host)
cmd_moc.qt = echo "$(subst ",\",$(_cmd_moc.qt))" > [email protected] ; $(_cmd_moc.qt)
cmd_moc.qt.host = echo "$(subst ",\",$(_cmd_moc.qt.host))" > [email protected] ; $(_cmd_moc.qt.host)
cmd_uic.qt = echo "$(subst ",\",$(_cmd_uic.qt))" > [email protected] ; $(_cmd_uic.qt)
cmd_uic.qt.host = echo "$(subst ",\",$(_cmd_uic.qt.host))" > [email protected] ; $(_cmd_uic.qt.host)
cmd_depend.m = echo "$(subst ",\",$(_cmd_depend.m))" > [email protected] ; $(_cmd_depend.m)
cmd_compile.m = echo "$(subst ",\",$(_cmd_compile.m))" > [email protected] ; $(_cmd_compile.m)
cmd_link.m = echo "$(subst ",\",$(_cmd_link.m))" > [email protected] ; $(_cmd_link.m)
cmd_link_so.m = echo "$(subst ",\",$(_cmd_link_so.m))" > [email protected] ; $(_cmd_link_so.m)
cmd_depend.m.host = echo "$(subst ",\",$(_cmd_depend.m.host))" > [email protected] ; $(_cmd_depend.m.host)
cmd_compile.m.host = echo "$(subst ",\",$(_cmd_compile.m.host))" > [email protected] ; $(_cmd_compile.m.host)
cmd_link.m.host = echo "$(subst ",\",$(_cmd_link.m.host))" > [email protected] ; $(_cmd_link.m.host)
cmd_link_so.m.host = echo "$(subst ",\",$(_cmd_link_so.m.host))" > [email protected] ; $(_cmd_link_so.m.host)
cmd_ar = echo "$(subst ",\",$(_cmd_ar))" > [email protected] ; $(_cmd_ar)
cmd_ranlib = echo "$(subst ",\",$(_cmd_ranlib))" >> [email protected] ; $(_cmd_ranlib)
cmd_ld = echo "$(subst ",\",$(_cmd_ld))" > [email protected] ; $(_cmd_ld)
cmd_ld.host = echo "$(subst ",\",$(_cmd_ld.host))" > [email protected] ; $(_cmd_ld.host)
cmd_cp = $(_cmd_cp)
cmd_mkdir = $(_cmd_mkdir)
cmd_clean = $(_cmd_clean)
cmd_dist = $(_cmd_dist)
cmd_distclean = $(_cmd_distclean)
#
# DO
#
do_depend.c = @$(disp_depend.c) ; $(MKDIR) $$(dir $$@); $(cmd_depend.c)
do_compile.c = @$(disp_compile.c) ; $(MKDIR) $$(dir $$@); $(cmd_compile.c)
do_link.c = @$(disp_link.c) ; $(MKDIR) $$(dir $$@); $(cmd_link.c)
do_link_so.c = @$(disp_link_so.c) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.c)
do_depend.c.host = @$(disp_depend.c.host) ; $(MKDIR) $$(dir $$@); $(cmd_depend.c.host)
do_compile.c.host = @$(disp_compile.c.host) ; $(MKDIR) $$(dir $$@); $(cmd_compile.c.host)
do_link.c.host = @$(disp_link.c.host) ; $(MKDIR) $$(dir $$@); $(cmd_link.c.host)
do_link_so.c.host = @$(disp_link_so.c.host) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.c.host)
do_depend.cxx = @$(disp_depend.cxx) ; $(MKDIR) $$(dir $$@); $(cmd_depend.cxx)
do_compile.cxx = @$(disp_compile.cxx) ; $(MKDIR) $$(dir $$@); $(cmd_compile.cxx)
do_link.cxx = @$(disp_link.cxx) ; $(MKDIR) $$(dir $$@); $(cmd_link.cxx)
do_link_so.cxx = @$(disp_link_so.cxx) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.cxx)
do_depend.cxx.host = @$(disp_depend.cxx.host) ; $(MKDIR) $$(dir $$@); $(cmd_depend.cxx.host)
do_compile.cxx.host = @$(disp_compile.cxx.host) ; $(MKDIR) $$(dir $$@); $(cmd_compile.cxx.host)
do_link.cxx.host = @$(disp_link.cxx.host) ; $(MKDIR) $$(dir $$@); $(cmd_link.cxx.host)
do_link_so.cxx.host = @$(disp_link_so.cxx.host) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.cxx.host)
do_moc.qt = @$(disp_moc.qt) ; $(MKDIR) $$(dir $$@); $(cmd_moc.qt)
do_moc.qt.host = @$(disp_moc.qt.host ; $(MKDIR) $$(dir $$@); $(cmd_moc.qt.host)
do_uic.qt = @$(disp_uic.qt) ; $(MKDIR) $$(dir $$@); $(cmd_uic.qt)
do_uic.qt.host = @$(disp_uic.qt.host ; $(MKDIR) $$(dir $$@); $(cmd_uic.qt.host)
do_depend.m = @$(disp_depend.m) ; $(MKDIR) $$(dir $$@); $(cmd_depend.m)
do_compile.m = @$(disp_compile.m) ; $(MKDIR) $$(dir $$@); $(cmd_compile.m)
do_link.m = @$(disp_link.m) ; $(MKDIR) $$(dir $$@); $(cmd_link.m)
do_link_so.m = @$(disp_link_so.m) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.m)
do_depend.m.host = @$(disp_depend.m.host) ; $(MKDIR) $$(dir $$@); $(cmd_depend.m.host)
do_compile.m.host = @$(disp_compile.m.host) ; $(MKDIR) $$(dir $$@); $(cmd_compile.m.host)
do_link.m.host = @$(disp_link.m.host) ; $(MKDIR) $$(dir $$@); $(cmd_link.m.host)
do_link_so.m.host = @$(disp_link_so.m.host) ; $(MKDIR) $$(dir $$@); $(cmd_link_so.m.host)
do_ar = @$(disp_ar) ; $(MKDIR) $$(dir $$@); $(cmd_ar)
do_ranlib = @$(disp_ranlib) ; $(MKDIR) $$(dir $$@); $(cmd_ranlib)
do_ld = @$(disp_ld) ; $(MKDIR) $$(dir $$@); $(cmd_ld)
do_ld.host = @$(disp_ld.host) ; $(MKDIR) $$(dir $$@); $(cmd_ld.host)
do_cp = @$(disp_cp) ; $(MKDIR) $$(dir $$@); $(cmd_cp)
do_mkdir = @$(disp_mkdir) ; $(cmd_mkdir)
do_clean = @$(disp_clean) ; $(cmd_clean)
do_dist = @$(disp_dist) ; $(MKDIR) $$(dir $$@); $(cmd_dist)
do_distclean = @$(disp_distclean) ; $(cmd_distclean)
do_print_deps = @$(disp_print_deps)
#
# Functions
#
define target-defaults_base
$(eval comma = ,)
$(eval $1_sources_c = $(filter %.c,$2))
$(eval $1_headers_c = $(filter %.h,$2))
$(eval $1_sources_cc = $(filter %.cc,$2))
$(eval $1_sources_cpp = $(filter %.cpp,$2))
$(eval $1_headers_cxx = $(filter %.hh,$2))
$(eval $1_headers_cxx += $(filter %.hpp,$2))
$(eval $1_sources_moc = $(filter %.moc,$2))
$(eval $1_sources_uic = $(filter %.ui,$2))
$(eval $1_sources_m = $(filter %.m,$2))
$(eval $1_headers_m = $(filter %.h,$2))
$(eval $1_objects_c = $(addprefix .$1/, $(subst .c,.c.o,$($1_sources_c))))
$(eval $1_objects_cc = $(addprefix .$1/, $(subst .cc,.cc.o,$($1_sources_cc))))
$(eval $1_objects_cpp = $(addprefix .$1/, $(subst .cpp,.cpp.o,$($1_sources_cpp))))
$(eval $1_objects_moc = $(addprefix .$1/, $(subst .moc,-moc.cpp.o,$($1_sources_moc))))
$(eval $1_objects_m = $(addprefix .$1/, $(subst .m,.m.o,$($1_sources_m))))
$(eval $1_objects_e = $(subst ",,$(filter %.o,$2)))
$(eval $1_objects_e += $(subst ",,$(filter %.a,$2)))
$(eval $1_objects_e += $(subst ",,$(filter %.lib,$2)))
$(eval $1_depends_c = $(addprefix .$1/, $(subst .c,.c.d,$($1_sources_c))))
$(eval $1_depends_cc = $(addprefix .$1/, $(subst .cc,.cc.d,$($1_sources_cc))))
$(eval $1_depends_cpp = $(addprefix .$1/, $(subst .cpp,.cpp.d,$($1_sources_cpp))))
$(eval $1_depends_moc = $(addprefix .$1/, $(subst .moc,-moc.cpp.d,$($1_sources_moc))))
$(eval $1_depends_m = $(addprefix .$1/, $(subst .m,.m.d,$($1_sources_m))))
$(eval $1_cflags = $($1_cflags-y))
$(eval $1_cxxflags = $($1_cxxflags-y))
$(eval $1_includes = $(addprefix -I, $($1_includes-y)))
$(eval $1_libraries = $(addprefix -L, ./ $($1_libraries-y)))
$(eval $1_ldflags = $($1_ldflags-y))
$(eval $1_headers_uic = $(patsubst %.ui,.$1/%-ui.h,$(subst ../,__UPDIR__/,$($1_sources_uic))))
$(eval $1_depends_c = $(subst ../,__UPDIR__/,$($1_depends_c)))
$(eval $1_objects_c = $(subst ../,__UPDIR__/,$($1_objects_c)))
$(eval $1_depends_cc = $(subst ../,__UPDIR__/,$($1_depends_cc)))
$(eval $1_objects_cc = $(subst ../,__UPDIR__/,$($1_objects_cc)))
$(eval $1_depends_cpp = $(subst ../,__UPDIR__/,$($1_depends_cpp)))
$(eval $1_objects_cpp = $(subst ../,__UPDIR__/,$($1_objects_cpp)))
$(eval $1_depends_moc = $(subst ../,__UPDIR__/,$($1_depends_moc)))
$(eval $1_objects_moc = $(subst ../,__UPDIR__/,$($1_objects_moc)))
$(eval $1_depends_m = $(subst ../,__UPDIR__/,$($1_depends_m)))
$(eval $1_objects_m = $(subst ../,__UPDIR__/,$($1_objects_m)))
$(eval $1_objects = $($1_objects_c))
$(eval $1_objects += $($1_objects_cc))
$(eval $1_objects += $($1_objects_cpp))
$(eval $1_objects += $($1_objects_moc))
$(eval $1_objects += $($1_objects_m))
$(eval $1_directories = $(sort $(dir .$1/ $($1_objects_c) $($1_objects_cpp) $($1_objects_m) $($1_objects_moc))))
$(eval $1_depends = $(MAKEFILE_LIST) $($1_depends_c) $($1_depends_cc) $($1_depends_cpp) $($1_depends_m) $($1_depends_moc))
$(eval $1_depends_y = $($1_depends))
$(eval $1_depends_y += $($1_depends-y))
$(eval $1_depends-n += $($1_headers_c))
$(eval $1_depends-n += $($1_headers_m))
$(eval $1_depends-n += $($1_headers_cxx))
$(eval $1_depends_y += $($1_headers_uic))
$(eval target-builds += $1)
$(eval target-objects += $($1_objects_c))
$(eval target-objects += $($1_objects_cc))
$(eval target-objects += $($1_objects_cpp))
$(eval target-objects += $($1_objects_moc))
$(eval target-objects += $($1_objects_m))
$(eval target-depends += $($1_depends_c))
$(eval target-depends += $($1_depends_cc))
$(eval target-depends += $($1_depends_cpp))
$(eval target-depends += $($1_depends_moc))
$(eval target-depends += $($1_depends_m))
$(eval target-cleans += $1_clean)
$($1_directories):
$(do_mkdir) $($1_directories)
$($1_depends_c): $($1_headers_c)
$($1_depends_cpp): $($1_headers_cxx)
$($1_depends_m): $($1_headers_m)
$($1_objects_c): .$1/%.o: .$1/%.d $(MAKEFILE_LIST)
$($1_objects_cc): .$1/%.o: .$1/%.d $(MAKEFILE_LIST)
$($1_objects_cpp): .$1/%.o: .$1/%.d $(MAKEFILE_LIST)
$($1_objects_moc): .$1/%.o: .$1/%.d $(MAKEFILE_LIST)
$($1_objects_m): .$1/%.o: .$1/%.d $(MAKEFILE_LIST)
$($1_objects_e): $(MAKEFILE_LIST)
$(target-depends): $(filter-out $(target-builds) $($1_depends), $($1_depends_y))
$1: .$1/$1 $(MAKEFILE_LIST)
$(do_cp)
$(do_print_deps)
.NOTPARALLEL: $($1_depends_y) $($1_objects) $($1_objects_e)
.$1/$1: $($1_depends_y) $($1_objects) $($1_objects_e)
$1_clean: __FORCE
$(do_clean) $1 .$1 [email protected] $1.dSYM $($1_headers_uic)
$1_distclean: __FORCE
endef
define target-defaults-rule
$(eval source = $(patsubst $3,$4,$(subst __UPDIR__/,../,$2)))
$2: ${source} $(MAKEFILE_LIST)
$5
endef
define target-defaults
$(eval $(call target-defaults_base,$1,$2))
$(eval $(foreach F,$($1_depends_c), $(eval $(call target-defaults-rule,$1,$F,.$1/%.c.d,%.c,$(do_depend.c)))))
$(eval $(foreach F,$($1_objects_c), $(eval $(call target-defaults-rule,$1,$F,.$1/%.c.o,%.c,$(do_compile.c)))))
$(eval $(foreach F,$($1_depends_cc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cc.d,%.cc,$(do_depend.cxx)))))
$(eval $(foreach F,$($1_objects_cc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cc.o,%.cc,$(do_compile.cxx)))))
$(eval $(foreach F,$($1_depends_cpp), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.d,%.cpp,$(do_depend.cxx)))))
$(eval $(foreach F,$($1_objects_cpp), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.o,%.cpp,$(do_compile.cxx)))))
$(eval $(foreach F,$($1_headers_uic), $(eval $(call target-defaults-rule,$1,$F,.$1/%-ui.h,%.ui,$(do_uic.qt)))))
$(eval $(foreach F,$($1_sources_moc), $(eval $(call target-defaults-rule,$1,$(patsubst %.moc,.$1/%-moc.cpp,$F),.$1/%-moc.cpp,%.h,$(do_moc.qt)))))
$(eval $(foreach F,$($1_depends_moc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.d,.$1/%.cpp,$(do_depend.cxx)))))
$(eval $(foreach F,$($1_objects_moc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.o,.$1/%.cpp,$(do_compile.cxx)))))
$(eval $(foreach F,$($1_depends_m), $(eval $(call target-defaults-rule,$1,$F,.$1/%.m.d,%.m,$(do_depend.m)))))
$(eval $(foreach F,$($1_objects_m), $(eval $(call target-defaults-rule,$1,$F,.$1/%.m.o,%.m,$(do_compile.m)))))
endef
define target.host-defaults
$(eval $(call target-defaults_base,$1,$2))
$(eval $(foreach F,$($1_depends_c), $(eval $(call target-defaults-rule,$1,$F,.$1/%.c.d,%.c,$(do_depend.c.host)))))
$(eval $(foreach F,$($1_objects_c), $(eval $(call target-defaults-rule,$1,$F,.$1/%.c.o,%.c,$(do_compile.c.host)))))
$(eval $(foreach F,$($1_depends_cc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cc.d,%.cc,$(do_depend.cxx.host)))))
$(eval $(foreach F,$($1_objects_cc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cc.o,%.cc,$(do_compile.cxx.host)))))
$(eval $(foreach F,$($1_depends_cpp), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.d,%.cpp,$(do_depend.cxx.host)))))
$(eval $(foreach F,$($1_objects_cpp), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.o,%.cpp,$(do_compile.cxx.host)))))
$(eval $(foreach F,$($1_headers_uic), $(eval $(call target-defaults-rule,$1,$F,.$1/%-ui.h,%.ui,$(do_uic.qt)))))
$(eval $(foreach F,$($1_sources_moc), $(eval $(call target-defaults-rule,$1,$(patsubst %.moc,.$1/%-moc.cpp,$F),.$1/%-moc.cpp,%.h,$(do_moc.qt)))))
$(eval $(foreach F,$($1_depends_moc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.d,.$1/%.cpp,$(do_depend.cxx.host)))))
$(eval $(foreach F,$($1_objects_moc), $(eval $(call target-defaults-rule,$1,$F,.$1/%.cpp.o,.$1/%.cpp,$(do_compile.cxx.host)))))
$(eval $(foreach F,$($1_depends_m), $(eval $(call target-defaults-rule,$1,$F,.$1/%.m.d,%.m,$(do_depend.m.host)))))
$(eval $(foreach F,$($1_objects_m), $(eval $(call target-defaults-rule,$1,$F,.$1/%.m.o,%.m,$(do_compile.m.host)))))
endef
define target-variables
$(eval $(call target-defaults,$1,$2))
.$1/$1:
ifeq ($($1_sources_cpp),)
$(do_link.c)
else
$(do_link.cxx)
endif
$(do_print_deps)
endef
define target.host-variables
$(eval $(call target.host-defaults,$1,$2))
.$1/$1:
$(do_link.c.host)
$(do_print_deps)
endef
define target.so-variables
$(eval $(call target-defaults,$1,$2))
.$1/$1:
ifeq ($($1_sources_cpp),)
$(do_link_so.c)
else
$(do_link_so.cxx)
endif
$(do_print_deps)
endef
define target.so.host-variables
$(eval $(call target.host-defaults,$1,$2))
.$1/$1:
$(do_link_so.c.host)
$(do_print_deps)
endef
define target.a-variables
$(eval $(call target-defaults,$1,$2))
.$1/$1:
$(do_ar)
$(do_ranlib)
$(do_print_deps)
endef
define target.a.host-variables
$(eval $(call target.host-defaults,$1,$2))
.$1/$1:
$(do_ar.host)
$(do_ranlib.host)
$(do_print_deps)
endef
define target.o-variables
$(eval $(call target-defaults,$1,$2))
.$1/$1:
$(do_ld)
$(do_print_deps)
endef
define target.o.host-variables
$(eval $(call target.host-defaults,$1,$2))
.$1/$1:
$(do_ld.host)
$(do_print_deps)
endef
define target_empty-defaults
targets-empty += $1
$(addsuffix _clean, $1): __FORCE
$(do_clean) $1 .$1 [email protected]
endef
define subdir_empty-defaults
$(addsuffix _$2, $1): __FORCE
${Q}+ $(MAKE) $($1_makeflags-y) -C '$$(subst _$2,,$$@)' $2
endef
define subdir-defaults
subdirs += $1
$1: $1_all
$(do_print_deps)
$(addsuffix _all, $1): $($1_depends-y) __FORCE
${Q}+ $(MAKE) $($1_makeflags-y) -C '$$(subst _all,,$$@)' all
$(do_print_deps)
$(addsuffix _install, $1): __FORCE
${Q}+ $(MAKE) $($1_makeflags-y) -C '$$(subst _install,,$$@)' install
$(do_print_deps)
$(addsuffix _clean, $1): __FORCE
${Q}+ $(MAKE) $($1_makeflags-y) -C '$$(subst _clean,,$$@)' clean
endef
define dist-defaults
$(eval $1_dname = $(dir $1))
$(eval $1_names = $1)
$(eval $1_files = $(subst $($1_dname), , $($1_names)))
$(eval $1_files = $1)
$(eval target-cleans += $1_distclean)
$(eval target-dists += $(addprefix $(dist.dir)/$2/, $($1_files)))
$(dist.dir)/$2: $(dist.dir)
$(addprefix $(dist.dir)/$2/, $($1_files)): $1
$(do_dist)
$1_distclean: __FORCE
$(do_distclean) $(addprefix $(dist.dir)/$2/, $($1_files))
$(Q)if [ -e '$$(abspath $(dist.dir))' ]; then find '$$(abspath $(dist.dir))' -depth -type d -empty -exec rm -rf {} \; ; fi
endef
define dist.share-variables
$(eval $(call dist-defaults,$1,share/${dist.base}))
endef
define dist.include-variables
$(eval $(call dist-defaults,$1,include/${dist.base}))
endef
define dist.obj-variables
$(eval $(call dist-defaults,$1,obj/${dist.base}))
endef
define dist.src-variables
$(eval $(call dist-defaults,$1,src/${dist.base}))
endef
define dist.lib-variables
$(eval $(call dist-defaults,$1,lib))
endef
define dist.bin-variables
$(eval $(call dist-defaults,$1,bin))
endef
#
# Definitions
#
# generate target variables
$(eval $(foreach T,$(call uniq,$(target-y)), $(eval $(call target-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.o-y)), $(eval $(call target.o-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.o-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.o-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.a-y)), $(eval $(call target.a-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.a-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.a-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.so-y)), $(eval $(call target.so-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.so-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.so-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.host-y)), $(eval $(call target.host-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.host-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.host-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.o.host-y)), $(eval $(call target.o.host-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.o.host-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.o.host-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.so.host-y)), $(eval $(call target.so.host-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.so.host-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.so.host-)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.a.host-y)), $(eval $(call target.a.host-variables,$T,$($T_files-y)))))
$(eval $(foreach T,$(call uniq,$(target.a.host-n)), $(eval $(call target_empty-defaults,$T))))
$(eval $(foreach T,$(call uniq,$(target.a.host-)), $(eval $(call target_empty-defaults,$T))))
# generate subdir targets
$(eval $(foreach S,$(call uniq,$(subdir-y)),$(eval $(call subdir-defaults,$S))))
$(eval $(foreach S,$(call uniq,$(subdir-n)),$(eval $(call subdir_empty-defaults,$S,clean))))
$(eval $(foreach S,$(call uniq,$(subdir-)),$(eval $(call subdir_empty-defaults,$S,clean))))
# distributin tags
ifneq ($(dist.dir),)
$(eval $(foreach D,$(call uniq,$(dist.bin-y)), $(eval $(call dist.bin-variables,$D))))
$(eval $(foreach D,$(call uniq,$(dist.lib-y)), $(eval $(call dist.lib-variables,$D))))
$(eval $(foreach D,$(call uniq,$(dist.obj-y)), $(eval $(call dist.obj-variables,$D))))
$(eval $(foreach D,$(call uniq,$(dist.src-y)), $(eval $(call dist.src-variables,$D))))