aboutsummaryrefslogtreecommitdiff
path: root/packages/Makefile
blob: 891045b7497bb37cdd0e3ad361086391e3f815e4 (plain)
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
#==============================================================================#
#
# Centralized cross-platform build system 
#
# see for instructions: http://puredata.org/docs/developer/build
#  <hans@at.or.at>
#
#==============================================================================#

CWD := $(shell pwd)

cvs_root_dir := $(shell cd $(CWD)/.. && pwd)
DESTDIR = $(CWD)/build
BUILDLAYOUT_DIR = $(CWD)


## default target
all: pd abstractions doc externals flext gem
#all: pd++
	@echo "Complete build succeeded!"

include $(BUILDLAYOUT_DIR)/Makefile.buildlayout

#==============================================================================#
#
# GET VERSIONS FOR RELEVANT SOFTWARE
#
#==============================================================================#


CYCLONE_MAJOR_VERSION := $(shell grep CYCLONE_VERSION \
	$(externals_src)/miXed/cyclone/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
CYCLONE_RELEASE := $(shell grep CYCLONE_RELEASE \
	$(externals_src)/miXed/cyclone/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
CYCLONE_BUILD := $(shell grep CYCLONE_BUILD \
	$(externals_src)/miXed/cyclone/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
CYCLONE_VERSION := $(CYCLONE_MAJOR_VERSION) $(CYCLONE_RELEASE) $(CYCLONE_BUILD)


FLEXT_MAJOR_VERSION := $(shell grep FLEXTMAJOR \
	$(externals_src)/grill/flext/buildsys/version.inc | cut -d '=' -f2)
FLEXT_MINOR_VERSION := $(shell grep FLEXTMINOR \
	$(externals_src)/grill/flext/buildsys/version.inc | cut -d '=' -f2)
FLEXT_MICRO_VERSION := $(shell grep FLEXTMICRO \
	$(externals_src)/grill/flext/buildsys/version.inc | cut -d '=' -f2)
FLEXT_VERSION := $(FLEXT_MAJOR_VERSION).$(FLEXT_MINOR_VERSION).$(FLEXT_MICRO_VERSION)


GEM_VERSION := $(shell grep "GEM_VERSION" $(gem_src)/src/Base/GemVersion.h | \
	cut -d '"' -f 2)


MAXLIB_VERSION := $(shell grep "define VERSION" \
	$(externals_src)/maxlib/maxlib.c | cut -d '"' -f 2)


OSC_VERSION := $(shell grep "define VERSION" $(externals_src)/OSCx/src/OSC.c | \
	cut -d '"' -f 2)


PDP_VERSION := $(shell grep PDP_VERSION= $(externals_src)/pdp/configure.ac | \
	cut -d '=' -f 2)


PMPD_VERSION := $(shell grep "define VERSION" \
	$(externals_src)/pmpd/src/pmpd.c | cut -d '"' -f 2)


TOXY_MAJOR_VERSION := $(shell grep TOXY_VERSION \
	$(externals_src)/miXed/toxy/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
TOXY_RELEASE := $(shell grep TOXY_RELEASE \
	$(externals_src)/miXed/toxy/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
TOXY_BUILD := $(shell grep TOXY_BUILD \
	$(externals_src)/miXed/toxy/build_counter | cut -d ' ' -f 3 | \
	cut -d '"' -f 2)
TOXY_VERSION := $(TOXY_MAJOR_VERSION) $(TOXY_RELEASE) $(TOXY_BUILD)


ZEXY_VERSION := $(shell grep VERSION $(externals_src)/zexy/src/zexy.h | \
	grep -v _VERSION | cut -d ' ' -f 3 | cut -d '"' -f 2)


# these are sent to all of the various Makefiles so that they all copy their
# output to the same directory tree
DEST_PATHS = BUILDLAYOUT_DIR=$(BUILDLAYOUT_DIR) \
				cvs_root_dir=$(cvs_root_dir) \
				DESTDIR=$(DESTDIR) \
				prefix=$(prefix) \
				libpddir=$(libpddir) \
				OPT_CFLAGS="$(OPT_CFLAGS)" \
				UNAME=$(UNAME)


#==============================================================================#
#
# BUILD TARGETS
#
#==============================================================================#

#------------------------------------------------------------------------------
# abstractions
abstractions:


#------------------------------------------------------------------------------
# doc
doc:


#------------------------------------------------------------------------------
# externals
externals: 
	$(MAKE) -C $(externals_src) $(DEST_PATHS)


#------------------------------------------------------------------------------
# flext
flext:
# temp hack -HCS
	test -f $(externals_src)/grill/flext/buildsys/mac/pd/config-gcc.def || \
		cp $(externals_src)/grill/flext/buildsys/mac/pd/config-gcc.def \
			$(externals_src)/grill/flext/buildsys/config-mac-pd-gcc.txt
# end temp hack
# tigital 8/30/2005 added
	cd $(externals_src)/grill/flext && \
		( \
        test -f buildsys/config-mac-pd-gcc.txt || \
          ( \
            cp buildsys/mac/pd/config-gcc.def buildsys/config-mac-pd-gcc.txt && \
            echo Copied template sys config file \
          ) \
      ) && \
		( \
			cat buildsys/config-mac-pd-gcc.txt | \
				sed "s|^PDPATH=.*|PDPATH=$(pd_src)|" > buildsys/config-mac-pd-gcc.txt \
		) && \
		( \
			cat package.txt | sed "s|^PRECOMPILE=.*|PRECOMPILE=|" > package.txt \
		) && \
		( \
			cat buildsys/mac/pd/gnumake-gcc-ext.inc | \
				sed "s|^LDFLAG\S +=.*|LDFLAG\S += -bundle -bundle_loader $(pd_src)/bin/pd|" > buildsys/mac/pd/gnumake-gcc-ext.inc \
		) && \
			( \
			cat buildsys/mac/pd/gnumake-gcc-flext.inc | \
				sed "s|^LDFLAG\S +=.*|LDFLAG\S += -dynamiclib -undefined dynamic_lookup |" > buildsys/mac/pd/gnumake-gcc-flext.inc \
		) && \
		( \
			test -f config.txt || \
			( \
				cp -f build/config-mac.def config.txt && \
				echo Copied template flext config file \
			) \
		) && \
		MACOSX_DEPLOYMENT_TARGET=10.3 bash build.sh pd gcc build-release-shared FLEXTLIB=@executable_path/../extra FLEXTINC=../flext/source FLEXTSYS=$(objectsdir)
	ln -sf $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.dylib
	install -p $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(objectsdir)
	ln -sf libflext-pd.$(FLEXT_VERSION).dylib $(objectsdir)/libflext-pd.dylib
	install -d $(examplesdir)
	cp -rp $(externals_src)/grill/flext/tutorial $(examplesdir)/flext
#	install -d $(manualsdir)/flext
	install -p	$(externals_src)/grill/flext/readme.txt   \
		$(readmesdir)/flext.txt
# FLEXTERNALS
#########
# dyn~
	cd $(externals_src)/grill/dynext && bash ../flext/build.sh pd gcc build-release-shared FLEXTLIB=../flext/pd-darwin/release-shared FLEXTINC=../flext/source FLEXTSYS=$(objectsdir)
	install -p $(externals_src)/grill/dynext/pd-darwin/release-shared/*.pd_darwin $(objectsdir)
	install -p $(externals_src)/grill/dynext/pd/*.pd $(helpdir)
#	install -d $(manualsdir)/dynext
	install -p $(externals_src)/grill/dynext/readme.txt   \
		$(readmesdir)/dynext.txt
#########
# pool
	cd $(externals_src)/grill/pool && bash ../flext/build.sh pd gcc build-release-shared FLEXTLIB=../flext/pd-darwin/release-shared FLEXTINC=../flext/source FLEXTSYS=$(objectsdir)
	install -p $(externals_src)/grill/pool/pd-darwin/release-shared/*.pd_darwin $(objectsdir)
	install -p $(externals_src)/grill/pool/pool-help.pd $(helpdir)
#	install -d $(manualsdir)/pool
	install -p $(externals_src)/grill/pool/readme.txt   \
		$(readmesdir)/pool.txt
#########
# py/pyext
#	cd $(externals_src)/grill/py && \
#		( \
#			cp -f build/config-mac.def config.txt \
#		) && \
#		bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
#	install -p $(externals_src)/grill/py/pd-darwin/release-shared/*.pd_darwin $(objectsdir)
# this wasn't building for me -HCS 2005-06-09
	install -d $(manualsdir)/py/examples
	install -d $(manualsdir)/py/scripts
	install -p $(externals_src)/grill/py/pd/*.pd $(manualsdir)/py/examples
	install -p $(externals_src)/grill/py/scripts/*.py $(manualsdir)/py/scripts
	install -p $(externals_src)/grill/py/readme.txt
		$(readmesdir)/py.txt
#	install -d $(INSTALL_PREFIX)/Library/Frameworks
#	cp -R /Library/Frameworks/Python.framework $(INSTALL_PREFIX)/Library/Frameworks
#########
# vasp
#  fails without the dir
#	test -d ../../vasp/pd-darwin || mkdir -p ../../vasp/pd-darwin 
#	cd $(externals_src)/grill/vasp/ && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
#	install -p $(externals_src)/grill/vasp/pd-darwin/release-shared/*.pd_darwin $(objectsdir)
# this wasn't building for me -HCS 2005-06-09
	install -p $(externals_src)/grill/vasp/pd-help/*.pd $(helpdir)
#	install -d $(manualsdir)/vasp
	install -p $(externals_src)/grill/vasp/readme.txt   \
		$(readmesdir)/vasp.txt
	install -d $(examplesdir)/vasp
	install -p $(externals_src)/grill/vasp/pd-ex/*.* $(examplesdir)/vasp
#########
# xsample
	cd $(externals_src)/grill/xsample && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
	install -p $(externals_src)/grill/xsample/pd-darwin/release-shared/*.pd_darwin $(objectsdir)
	install -p $(externals_src)/grill/xsample/pd/*.pd $(helpdir)
#	install -d $(manualsdir)/xsample
	install -p $(externals_src)/grill/xsample/readme.txt \
		$(readmesdir)/xsample.txt
########## FOOTILS #########
# syncgrain
#	cd $(externals_src)/footils/syncgrain/ && $(MAKE) -f makefile.pd-darwin
#	install -p $(externals_src)/footils/syncgrain/pd-darwin/*.pd_darwin \
#		$(objectsdir)
	install -p $(externals_src)/footils/syncgrain/pd/*.* $(helpdir)

# nusmuk
	-cd $(externals_src)/nusmuk/msd && $(externals_src)/grill/flext/build.sh \
		pd gcc
	-cd $(externals_src)/nusmuk/msd2D && $(externals_src)/grill/flext/build.sh \
		pd gcc
	-cd $(externals_src)/nusmuk/msd3D && $(externals_src)/grill/flext/build.sh \
		pd gcc


#------------------------------------------------------------------------------
# pd

ifeq ($(OS_NAME),darwin)
  PD_CONFIGURE_FLAGS = --enable-jack
else
  ifeq ($(OS_NAME),linux)
    PD_CONFIGURE_FLAGS = --enable-jack --enable-alsa
  else
    PD_CONFIGURE_FLAGS = 
  endif
endif

PD_BUILD_FLAGS = 

# Pd needs autoconf 2.5x, which is labeled differently on different machines
#PD_AUTOCONF := ${shell ( test -x "`which autoconf-2.59`" && echo autoconf-2.59 ) || echo autoconf }
PD_AUTOCONF = autoconf

$(pd_src)/src/configure: $(pd_src)/src/configure.in
	cd $(pd_src)/src/ && $(PD_AUTOCONF)

# this is not used yet because MinGW doesn't use ./configure && make yet
#$(pd_src)/src/makefile: $(pd_src)/src/makefile.in
#	cd $(pd_src)/src/ && ./configure $(PD_CONFIGURE_FLAGS)

pd: $(pd_src)/src/configure
	echo $$MACOSX_DEPLOYMENT_TARGET
	-cd $(pd_src)/src && ./configure $(PD_CONFIGURE_FLAGS) && \
		make $(DEST_PATHS) $(PD_BUILD_FLAGS)

pd++:
# the next line doesn't work?
#	echo $$MACOSX_DEPLOYMENT_TARGET=10.3
	-cd $(pd_src) && scons app_pkg=yes desire=no prefix=$(DESTDIR)\
		portaudiopath=../../../../dev/portaudio \
		portmidipath=../../../../dev/portmidi \
		atomic=yes threadedsf=no debug=yes install

#==============================================================================#
#
# INSTALL TARGETS
#
#==============================================================================#

# this is used for installing into a pre-build Pd binary
extended_install: abstractions_install doc_install extensions_install \
externals_install flext_install gem_install readme_install welcome_install \
license_install noncvs_install


#------------------------------------------------------------------------------
# install
install: pd_install extended_install
	@echo "Complete install succeeded!"

#------------------------------------------------------------------------------
# install_devel
devel_install: pd_devel_install
	@echo "Complete install succeeded!"

#------------------------------------------------------------------------------
# abstractions_install
abstractions_install:
	$(MAKE) -C $(abstractions_src) $(DEST_PATHS) install

#------------------------------------------------------------------------------
# doc_install
doc_install: 
	$(MAKE) -C $(doc_src) $(DEST_PATHS) install


#------------------------------------------------------------------------------
# extensions_install
extensions_install: 
	$(MAKE) -C $(extensions_src) $(DEST_PATHS) install


#------------------------------------------------------------------------------
# externals_install
externals_install: 
	$(MAKE) -C $(externals_src) $(DEST_PATHS) install



#------------------------------------------------------------------------------
# flext_install
flext_install:
# FLEXT
# temp hack -HCS
#	test -f $(externals_src)/grill/flext/buildsys/mac/pd/config-gcc.def || \
#		cp $(externals_src)/grill/flext/buildsys/mac/pd/config-gcc.def \
#			$(externals_src)/grill/flext/buildsys/config-mac-pd-gcc.txt
# end temp hack
# tigital 8/30/2005 added
#	cd $(externals_src)/grill/flext && \
#		( \
#        test -f buildsys/config-mac-pd-gcc.txt || \
#          ( \
#            cp buildsys/mac/pd/config-gcc.def buildsys/config-mac-pd-gcc.txt && \
#            echo Copied template sys config file \
#          ) \
#      ) && \
#		( \
#			cat buildsys/config-mac-pd-gcc.txt | \
#				sed "s/^PDPATH=.*/PDPATH=$(pd_src)/" > buildsys/config-mac-pd-gcc.txt \
#		) && \
#		( \
#			cat package.txt | sed "s/^PRECOMPILE=.*/PRECOMPILE=/" > package.txt \
#		) && \
#		( \
#			cat buildsys/mac/pd/gnumake-gcc-ext.inc | \
#				sed "s/^LDFLAG\S +=.*/LDFLAG\S += -bundle -bundle_loader $(pd_src)\/bin\/pd/" > buildsys/mac/pd/gnumake-gcc-ext.inc \
#		) && \
#			( \
#			cat buildsys/mac/pd/gnumake-gcc-flext.inc | \
#				sed "s/^LDFLAG\S +=.*/LDFLAG\S += -dynamiclib -undefined dynamic_lookup /" > buildsys/mac/pd/gnumake-gcc-flext.inc \
#		) && \
#		( \
#			test -f config.txt || \
#			( \
#				cp -f build/config-mac.def config.txt && \
#				echo Copied template flext config file \
#			) \
#		) && \
#		MACOSX_DEPLOYMENT_TARGET=10.3 bash build.sh pd gcc build-release-shared FLEXTLIB=@executable_path/../extra FLEXTINC=../flext/source FLEXTSYS=$(objectsdir)
#	ln -sf $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.dylib
#	install -p $(externals_src)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(objectsdir)
#	ln -sf libflext-pd.$(FLEXT_VERSION).dylib $(objectsdir)/libflext-pd.dylib
	install -d $(manualsdir)/flext
	cp -rp $(externals_src)/grill/flext/tutorial $(manualsdir)/flext
	install -p $(externals_src)/grill/flext/gpl.txt  \
		$(externals_src)/grill/flext/readme.txt   \
		$(externals_src)/grill/flext/license.txt  \
		$(manualsdir)/flext
# FLEXTERNALS
#------------------------------------------------------------------------------#
# dyn~
#	-cd $(externals_src)/grill/dynext && \
#		bash ../flext/build.sh pd gcc build-release-shared \
#			FLEXTLIB=../flext/pd-darwin/release-shared \
#			FLEXTINC=../flext/source FLEXTSYS=$(objectsdir)
	-install -p $(externals_src)/grill/dynext/pd-darwin/release-shared/*.$(EXTENSION) $(objectsdir)
	install -p $(externals_src)/grill/dynext/pd/*.pd $(helpdir)
	install -d $(manualsdir)/dynext
	install -p $(externals_src)/grill/dynext/gpl.txt  \
		$(externals_src)/grill/dynext/readme.txt   \
		$(externals_src)/grill/dynext/license.txt  \
		$(manualsdir)/dynext
#########
# pool
#	-cd $(externals_src)/grill/pool && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
	-install -p $(externals_src)/grill/pool/pd-darwin/release-shared/*.$(EXTENSION) $(objectsdir)
	install -p $(externals_src)/grill/pool/pool-help.pd $(helpdir)
	install -d $(manualsdir)/pool
	install -p $(externals_src)/grill/pool/gpl.txt \
		$(externals_src)/grill/pool/readme.txt   \
		$(externals_src)/grill/pool/license.txt \
		$(manualsdir)/pool
#########
# py/pyext
#	cd $(externals_src)/grill/py && \
#		( \
#			cp -f build/config-mac.def config.txt \
#		) && \
#		bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
#	install -p $(externals_src)/grill/py/pd-darwin/release-shared/*.$(EXTENSION) $(objectsdir)
# this wasn't building for me -HCS 2005-06-09
	install -d $(examplesdir)/py/examples
	install -d $(examplesdir)/py/scripts
	install -p $(externals_src)/grill/py/pd/*.pd $(examplesdir)/py/examples
	install -p $(externals_src)/grill/py/scripts/*.py $(examplesdir)/py/scripts
	install -d $(manualsdir)/py/scripts
	install -p $(externals_src)/grill/py/gpl.txt  \
		$(externals_src)/grill/py/readme.txt $(externals_src)/grill/py/license.txt \
		$(manualsdir)/py
#	install -d $(prefix)/Library/Frameworks
#	cp -R /Library/Frameworks/Python.framework $(prefix)/Library/Frameworks
#########
# vasp
#  fails without the dir
#	test -d ../../vasp/pd-darwin || mkdir -p ../../vasp/pd-darwin 
#	cd $(externals_src)/grill/vasp/ && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
#	install -p $(externals_src)/grill/vasp/pd-darwin/release-shared/*.$(EXTENSION) $(objectsdir)
# this wasn't building for me -HCS 2005-06-09
	install -d $(helpdir)/vasp
	install -p $(externals_src)/grill/vasp/pd-help/*.pd $(helpdir)/vasp
	install -d $(manualsdir)/vasp
	install -p $(externals_src)/grill/vasp/gpl.txt  \
		$(externals_src)/grill/vasp/readme.txt   \
		$(externals_src)/grill/vasp/license.txt  \
		$(externals_src)/grill/vasp/changes.txt  \
		$(externals_src)/grill/vasp/todo.txt     \
		$(manualsdir)/vasp
	install -d $(examplesdir)/vasp
	cp -rp $(externals_src)/grill/vasp/pd-ex $(examplesdir)/vasp
#########
# xsample
#	cd $(externals_src)/grill/xsample && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(objectsdir) FLEXTINC=../flext/source
#	install -p $(externals_src)/grill/xsample/pd-darwin/release-shared/*.$(EXTENSION) $(objectsdir)
	install -p $(externals_src)/grill/xsample/pd/*.pd $(helpdir)
	install -d $(manualsdir)/xsample
	install -p $(externals_src)/grill/xsample/gpl.txt \
		$(externals_src)/grill/xsample/readme.txt \
		$(externals_src)/grill/xsample/license.txt \
		$(manualsdir)/xsample
########## FOOTILS #########
# syncgrain
#	cd $(externals_src)/footils/syncgrain/ && $(MAKE) -f makefile.pd-darwin
#	install -p $(externals_src)/footils/syncgrain/pd-darwin/*.$(EXTENSION) \
#		$(objectsdir)
	install -p $(externals_src)/footils/syncgrain/pd/*.* $(helpdir)
########## NUSMUK ##########
# nusmuk
#	cd $(externals_src)/nusmuk/msd && $(externals_src)/grill/flext/build.sh \
#		pd gcc install
#	cd $(externals_src)/nusmuk/msd2D && $(externals_src)/grill/flext/build.sh \
#		pd gcc install
#	cd $(externals_src)/nusmuk/msd3D && $(externals_src)/grill/flext/build.sh \
#		pd gcc install
#TODO: need to add nusmuk/editor


#------------------------------------------------------------------------------
# gem_install
GEM_NAME = Gem
$(gem_src)/src/configure: 
	make -C $(gem_src)/src configure

# each platform currently needs a custom ./configure, so this is commented out
# until the ./configure defaults work on all three platforms
#$(gem_src)/src/Make.config: $(gem_src)/src/Make.config.in
#	cd $(gem_src)/src && ./configure	--with-pd=$(pd_src)

$(gem_src)/src/Gem.dll:

$(gem_src)/src/Gem.pd_linux: $(gem_src)/src/configure
# always run aclocal/autoconf until "configure" is deleted from CVS
	cd $(gem_src)/src && aclocal
	cd $(gem_src)/src && autoconf
	cd $(gem_src)/src && ./configure --without-ffmpeg --with-pd=$(pd_src)
	$(MAKE) -C $(gem_src)/src

$(gem_src)/src/Gem.pd_darwin: $(gem_src)/src/configure
# always run aclocal/autoconf until "configure" is deleted from CVS
	cd $(gem_src)/src && aclocal
	cd $(gem_src)/src && autoconf
	cd $(gem_src)/src && ./configure --without-ImageMagick --with-pd=$(pd_src)
	$(MAKE) -C $(gem_src)/src

gem: $(gem_src)/src/Gem.$(EXTENSION)

gem_install: gem $(helpdir)
	install -d $(helpdir)/$(GEM_NAME)
	install -p $(gem_src)/help/*.* $(helpdir)/$(GEM_NAME)
	install -p $(gem_src)/abstractions/*-help.pd $(helpdir)/$(GEM_NAME)
	install -d $(objectsdir)/$(GEM_NAME)
ifneq ($(OS_NAME),windows)
	install -p $(gem_src)/src/Gem.$(EXTENSION)   $(objectsdir)
endif
	install -p $(shell ls -1 $(gem_src)/abstractions/*.* | \
		grep -v '\-help.pd')  $(objectsdir)/$(GEM_NAME)
	install -d $(manualsdir)/$(GEM_NAME)
	install -p $(gem_src)/doc/*.* $(manualsdir)/$(GEM_NAME)
	install -d $(manualsdir)/$(GEM_NAME)/manual
	install -p $(gem_src)/manual/*.* $(manualsdir)/$(GEM_NAME)/manual
	for dir in $(shell ls -1 $(gem_src)/examples | grep -v CVS); do \
		echo "installing $$dir"; \
		install -d $(examplesdir)/$(GEM_NAME)/$$dir ; \
		install -p $(gem_src)/examples/$$dir/*.* $(examplesdir)/$(GEM_NAME)/$$dir ;\
	done


#------------------------------------------------------------------------------
# noncvs_install
# this is for including pre-compiled binaries in a build
noncvs_install:
	-install -p $(packages_src)/noncvs/$(OS_NAME)/bin/*.* $(bindir)
	-install -p $(packages_src)/noncvs/$(OS_NAME)/doc/5.reference/*.* $(helpdir)
	-install -p $(packages_src)/noncvs/$(OS_NAME)/extra/*.* $(objectsdir)
	-install -d $(DESTDIR)$(prefix)/gripd
	-install -p $(packages_src)/noncvs/$(OS_NAME)/gripd/*.* \
		$(DESTDIR)$(prefix)/gripd


#------------------------------------------------------------------------------
# pd_install
PD_NAME=Pd
pd_install: pd
	$(MAKE) -C $(pd_src)/src $(DEST_PATHS) $(PD_BUILD_FLAGS) install
	install -d $(manualsdir)/$(PD_NAME)
	install -p $(pd_src)/src/notes.txt $(manualsdir)/$(PD_NAME)

#------------------------------------------------------------------------------
# pd_devel_install
##PD_NAME=Pd++  # this breaks Pd-extended compilation!
# it should use its own variable, like PDDEVEL_NAME <hans@at.or.at>
pd_devel_install: pd++
	install -d $(manualsdir)/$(PD_NAME)
	install -p $(pd_src)/src/notes.txt $(manualsdir)/$(PD_NAME)

#==============================================================================#
#
# GENERATE TEXT FILES FOR PACKAGE
#
#==============================================================================#

LICENSE_FILE = $(manualsdir)/$(PD_NAME)/License.html
license_install:
  # generate HTML version of License
	install -d $(manualsdir)/$(PD_NAME)
	-rm $(LICENSE_FILE)
	touch $(LICENSE_FILE)
	echo "<html><body>" >> "$(LICENSE_FILE)"
	echo "<h3>(Parts of this package can be used under " >> "$(LICENSE_FILE)"
	echo "<a href="Pd-LICENSE.txt">Pd&quot;s BSD license</a>)</h3>" >> "$(LICENSE_FILE)"
	echo "<font size=\"-1\">" >> "$(LICENSE_FILE)"
	cat "$(externals_src)/creb/COPYING" | sed -e 's/^$$/\<P\>/g' >> "$(LICENSE_FILE)"
	echo "</font></body></html>" >> $(LICENSE_FILE)
# Pd's license file
	install -p "$(pd_src)/LICENSE.txt" "$(manualsdir)/$(PD_NAME)/Pd-LICENSE.txt"



WELCOME_FILE = $(manualsdir)/$(PD_NAME)/Welcome.html
welcome_install:
	install -d $(manualsdir)/$(PD_NAME)
	-rm $(WELCOME_FILE)
	touch $(WELCOME_FILE)
	echo "<html><head>" >> $(WELCOME_FILE)
	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://puredata.org/ploneCustom.css\" />" >> $(README_FILE)
	echo "</head>" >> $(README_FILE)
	echo "<body><p><p>" >> $(WELCOME_FILE)
	echo "<center><img src=\"\">" >> $(WELCOME_FILE)
	echo "<h2>Version $(PD_VERSION)</h2>" >> $(WELCOME_FILE)
	echo "<p>written by Miller S. Puckette</p></center>" >> $(WELCOME_FILE)
	echo "<font size=\"-1\">" >> $(WELCOME_FILE)
	echo "<p>`grep -A9 ACKNOWLEDG $(pd_src)/README.txt`</p>" >> $(WELCOME_FILE)
	echo "</font>" >> $(WELCOME_FILE)
	echo "</body></html>" >> $(WELCOME_FILE)



README_FILE = $(manualsdir)/$(PD_NAME)/ReadMe.html
readme_install: 
	install -d $(manualsdir)/$(PD_NAME)
	echo $(CYCLONE_RELEASE)
	-rm $(README_FILE)
	touch $(README_FILE)
	echo "<html>" >> $(README_FILE)
	echo "<head>" >> $(README_FILE)
	echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />" >> $(README_FILE)
	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://puredata.org/plone.css\" />" >> $(README_FILE)
	echo "</head>" >> $(README_FILE)
	echo "<body>" >> $(README_FILE)
	echo "<h2>Pure Data $(PD_VERSION)</h2>" 	>> $(README_FILE)
	echo "<p>Pd is a real-time, graphical programming language for media processing.  It provides an environment for audio analysis, synthesis, and processing, with a rich set of multimedia capabilities.  You can get Pd for Linux, Windows, MacOS X, BSD, or IRIX.</p>" >> $(README_FILE)
	echo "<p>For more information, go to: <a href=\"http://puredata.org\" target=\"pd\">http://puredata.org</a></p>" >> $(README_FILE)
	echo "<h3>Installation</h3>" >> $(README_FILE)	
ifeq ($(OS_NAME),linux)
	echo "<p></p>" >> $(README_FILE)
	echo "<p></p>" >> $(README_FILE)
endif
ifeq ($(OS_NAME),darwin)
	echo "<p>To install Pd, drag the $(PACKAGE_NAME).app into your /Applications folder.</p>" >> $(README_FILE)	
	echo "<p>If you want to have all of the included libraries loaded at startup, copy <code>org.puredata.pd.plist</code> to <code>~/Library/Preferences</code> (<code>~</code> means your home folder).  WARNING: this will overwrite any existing Pd preferences!</p>" >> $(README_FILE)	
endif
ifeq ($(OS_NAME),windows)
	echo "<p>To install, run the installer.</p>" >> $(README_FILE)
	echo "<p>To make sure that all of the included libraries are loaded when Pd runs, " >> $(README_FILE)
	echo "double-click <code>C:\Program Files\pd\pd-settings.reg</code> to import the settings to the registry.  WARNING: this will overwrite any existing Pd preferences!</p>" >> $(README_FILE)
endif
	echo "<h3>Pure Data CVS Developers</h3>" >> $(README_FILE)	
# this may seem whack, but it generates the list of developers from the SourceForge site:
	curl 'http://sourceforge.net/project/memberlist.php?group_id=55736' | grep -A2 -e '<td>' | sed 's|\(href="\)|target="w" \1http://sourceforge.net|' >> $(README_FILE)
	echo "</p>" >> $(README_FILE)
	echo "<p>" >> $(README_FILE)
	echo "Many others not listed have contributed their time and effort, this is just a list of the current developers in the SourceForge project.  But really, every Pd user is a developer and is encouraged to contribute to the CVS repository." >> $(README_FILE)
	echo "</p>" >> $(README_FILE)
	echo "<h3>License</h3>" >> $(README_FILE)	
	echo "<p>" >> $(README_FILE)
	echo 'This package is released under the <a href="http://www.gnu.org/copyleft/gpl.html" target="gpl">GNU GPL</a>.  The Pd core and some other included code is originally available with a <a href="http://pure-data.cvs.sourceforge.net/pure-data/pd/LICENSE.txt">BSD license</a> from the Pd CVS on SourceForge.' >> $(README_FILE)
	echo "</p>" >> $(README_FILE)
	echo "<h3>Included Versions</h3>" >> $(README_FILE)	
	echo "<p>These externals are all included from the Pd CVS repository:</p>" >> $(README_FILE)
	echo "<ul>" >> $(README_FILE)
	echo "<li>pure data: $(PD_VERSION) " >> $(README_FILE)
	echo "<li>cyclone: $(CYCLONE_VERSION)" >> $(README_FILE)
	echo "<li>flext: $(FLEXT_VERSION)" >> $(README_FILE)
	echo "<li>gem: $(GEM_VERSION)" >> $(README_FILE)
	echo "<li>iemlib: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>maxlib: $(MAXLIB_VERSION)" >> $(README_FILE)
	echo "<li>osc: $(OSC_VERSION)" >> $(README_FILE)
	echo "<li>pmpd: $(PMPD_VERSION)" >> $(README_FILE)
	echo "<li>pd-abstractions: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>pd-doc: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>pd-externals: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>pddp: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>pdp: $(PDP_VERSION)" >> $(README_FILE)
	echo "<li>toxy: $(TOXY_VERSION)" >> $(README_FILE)
	echo "<li>unauthorized: `date +20%y.%m.%d`" >> $(README_FILE)
	echo "<li>zexy: $(ZEXY_VERSION)" >> $(README_FILE)
	echo "</ul>" >> $(README_FILE)
	echo "<h3>Patented Algorithms</h3>" >> $(README_FILE)
	echo "<p>" >> $(README_FILE)
	echo "This package may contain software that is covered by patents in certain countries.  In order to use this software you must have the proper license.  Below is a list of the known software packages that are covered by patents in some countries:" >> $(README_FILE)
	echo "</p>" >> $(README_FILE)
	echo "<ul>" >> $(README_FILE)
	echo '<li><a href="http://en.wikipedia.org/wiki/MP3" target="license">MP3 aka MPEG-1 Part 3 Layer 3</a></li>' >> $(README_FILE)
	echo '<li><a href="http://en.wikipedia.org/wiki/MPEG-2" target="license">MPEG-2</a></li>' >> $(README_FILE)
	echo '<li><a href="http://en.wikipedia.org/wiki/MPEG-4#Licensing" target="license">MPEG-4</a></li>' >> $(README_FILE)
	echo "</ul>" >> $(README_FILE)
	echo '<p>Please consider trying to get rid of software patents in your country: <a href="http://www.nosoftwarepatents.com" target="nsp">http://www.nosoftwarepatents.com</a></p>' >> $(README_FILE)
	echo "(this package was built on `date`) <BR>" >> $(README_FILE)
	echo "</body></html>" >> $(README_FILE)



#==============================================================================#
#
## FINAL ASSEMBLY
#
#==============================================================================#


#----------------------------------------------------------------------------
# DOC_FORMAT
doc_format:
# clean out cruft files
	-find $(DESTDIR) -name .DS_Store -delete
	-find $(DESTDIR) -name '*.*.bak' -delete
# run script to move help-*.pd files to *-help.pd according to the standard
	cd $(helpdir) && \
		$(scripts_src)/convert-help-to-standard.sh
# remove write perms to prevent people form editing the helpfiles by mistake
	find $(pddocdir) -name '*.pd' -print0 | xargs -0 chmod a-wx
	find $(pddocdir) -name '*.txt' -print0 | xargs -0 chmod a-wx



#----------------------------------------------------------------------------
# STRIP_HACK
# not all of the build systems are stripping the externals, so strip them here.
# Gem, xsample, and some other things don't like to be stripped
strip_hack:
	$(STRIP) $(objectsdir)/*/*.$(EXTENSION)
	$(STRIP) $(objectsdir)/[A-FH-Za-wyz]*.$(EXTENSION)



#==============================================================================#
#
# DEVELOPER TARGETS
#
#==============================================================================#

devsymlinks: devsymlinks_$(OS_NAME)



devsymlinks_windows:


devsymlinks_linux:


TCLTK_VERSION=8.4
devsymlinks_darwin: devsymlinks_clean
# this makes /usr/local symlinks to the Tcl/Tk frameworks so that ./configure
# can find them.
# headers
	test -e  /Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tcl.h && \
		sudo ln -s \
			/Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tcl.h \
			/usr/local/include/tcl.h
	test -e  /Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tclDecls.h && \
		sudo ln -s \
			/Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tclDecls.h \
			/usr/local/include/tclDecls.h
	test -e  /Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tclPlatDecls.h && \
		sudo ln -s \
			/Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Headers/tclPlatDecls.h \
			/usr/local/include/tclPlatDecls.h
# libs
	test -e  /Library/Frameworks/Tcl.framework/tclConfig.sh && \
		sudo ln -s /Library/Frameworks/Tcl.framework/tclConfig.sh /usr/local/lib
	test -e  /Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Tcl && \
		sudo ln -s \
			/Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/Tcl \
			/usr/local/lib/libtcl$(TCLTK_VERSION).dylib
	test -e  /Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/libtclstub$(TCLTK_VERSION).a && \
		sudo ln -s \
			/Library/Frameworks/Tcl.framework/Versions/$(TCLTK_VERSION)/libtclstub$(TCLTK_VERSION).a \
			/usr/local/lib/libtclstub$(TCLTK_VERSION).a
	test -e  /usr/local/lib/libtcl$(TCLTK_VERSION).dylib && \
		sudo ln -s /usr/local/lib/libtcl$(TCLTK_VERSION).dylib /usr/local/lib/libtcl.dylib
# headers
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tk.h && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tk.h \
			/usr/local/include/tk.h
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkDecls.h && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkDecls.h \
			/usr/local/include/tkDecls.h
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkIntXlibDecls.h && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkIntXlibDecls.h \
			/usr/local/include/tkIntXlibDecls.h
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkMacOSX.h && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkMacOSX.h \
			/usr/local/include/tkMacOSX.h
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkPlatDecls.h && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Headers/tkPlatDecls.h \
			/usr/local/include/tkPlatDecls.h
# libs
	test -e  /Library/Frameworks/Tk.framework/tkConfig.sh && \
		sudo ln -s /Library/Frameworks/Tk.framework/tkConfig.sh /usr/local/lib
	test -e  /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Tk && \
		sudo ln -s /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/Tk \
			/usr/local/lib/libtk$(TCLTK_VERSION).dylib
	test -e /Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/libtkstub$(TCLTK_VERSION).a && \
		sudo ln -s \
			/Library/Frameworks/Tk.framework/Versions/$(TCLTK_VERSION)/libtkstub$(TCLTK_VERSION).a \
			/usr/local/lib/libtkstub$(TCLTK_VERSION).a
	test -e  /usr/local/lib/libtk$(TCLTK_VERSION).dylib && \
		sudo ln -s /usr/local/lib/libtk$(TCLTK_VERSION).dylib /usr/local/lib/libtk.dylib



devsymlinks_clean:
	-sudo rm -f /usr/local/include/tcl*.h /usr/local/include/tk*.h
	-sudo rm -f /usr/local/lib/tclConfig.sh /usr/local/lib/tkConfig.sh
	-sudo rm -f /usr/local/lib/libtcl*.dylib /usr/local/lib/libtk*.dylib
	-sudo rm -f /usr/local/lib/libtclstub*.a /usr/local/lib/libtkstub*.a



patch_pd:
	@echo pd_src $(pd_src)
# apply all platform-neutral patches
	for patch in $(shell ls -1 $(CWD)/patches/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 < $$patch; \
	done
# apply all platform-specific patches
ifneq ($(OS_NAME),windows)
	for patch in $(shell ls -1 $(CWD)/patches/$(OS_NAME)/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 < $$patch; \
	done
endif
	-rm -f -- $(pd_src)/src/configure  $(pd_src)/src/makefile
# change Pd's version number to reflect the extended build
# this needs the complete_version_defines patch to work
	cd $(pd_src)/src/ && \
		sed 's|^\(#define PD_TEST_VERSION "\).*"|\1$(PACKAGE_VERSION)"|' m_pd.h > \
			m_pd.h.tmp && mv m_pd.h.tmp m_pd.h
	@echo " "
	@echo "patching completed."


unpatch_pd:
# change the version number back to the original 
# this needs the complete_version_defines patch to work
	cd $(pd_src)/src && \
		sed 's|^\(#define PD_TEST_VERSION ".*\)$(PACKAGE_VERSION)"|\1"|' \
			m_pd.h > m_pd.h.tmp && \
		mv m_pd.h.tmp m_pd.h
# apply all platform-specific patches
	for patch in $(shell ls -1r $(CWD)/patches/$(OS_NAME)/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 -R < $$patch; \
	done
# apply all platform-neutral patches
	for patch in $(shell ls -1r $(CWD)/patches/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 -R < $$patch; \
	done
	-rm -f -- $(pd_src)/src/configure  $(pd_src)/src/makefile
	@echo " "
	@echo "unpatching completed."

patch_pd_devel:
	@echo pd_src $(pd_src)
# apply all platform-neutral patches
	for patch in $(shell ls -1 $(CWD)/patches/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 < $$patch; \
	done
# apply all platform-specific patches
	for patch in $(shell ls -1 $(CWD)/patches/$(OS_NAME)/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 < $$patch; \
	done
	-rm -f -- $(pd_src)/src/configure  $(pd_src)/src/makefile
# change Pd's version number to reflect the extended build
# this needs the complete_version_defines patch to work
	cd $(pd_src)/src/ && \
		sed 's|^\(#define PD_TEST_VERSION "\).*"|\1$(PACKAGE_VERSION)"|' m_pd.h > \
			m_pd.h.tmp && mv m_pd.h.tmp m_pd.h
	@echo " "
	@echo "patching completed."


unpatch_pd_devel:
# change the version number back to the original 
# this needs the complete_version_defines patch to work
	cd $(pd_src)/src && \
		sed 's|^\(#define PD_TEST_VERSION ".*\)$(PACKAGE_VERSION)"|\1"|' \
			m_pd.h > m_pd.h.tmp && \
		mv m_pd.h.tmp m_pd.h
# apply all platform-specific patches
	for patch in $(shell ls -1r $(CWD)/patches/$(OS_NAME)/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 -R < $$patch; \
	done
# apply all platform-neutral patches
	for patch in $(shell ls -1r $(CWD)/patches/*.patch); do \
		echo "Applying $$patch"; \
		cd $(pd_src)/src/ && patch -p0 -R < $$patch; \
	done
	-rm -f -- $(pd_src)/src/configure  $(pd_src)/src/makefile
	@echo " "
	@echo "unpatching completed."

#==============================================================================#
#
# CLEAN TARGETS
#
#==============================================================================#
abstractions_clean:
	-$(MAKE) -C $(abstractions_src) $(DEST_PATHS) clean


doc_clean:


externals_clean:
	-$(MAKE) -C $(externals_src) $(DEST_PATHS) clean


flext_clean:
	-cd $(externals_src)/footils/syncgrain && make -f makefile.pd-darwin clean
	-cd $(externals_src)/grill && \
		rm -- flext/buildsys/config-mac-pd-gcc.txt config.txt flext/config.txt \
			flext/source/libflext.a */pd-darwin/*.o */pd-darwin/*/*.o \
		 	*/pd-darwin/*/*.pd_darwin */pd-darwin/*.pd_darwin \
			*/pd-darwin/release-shared/*.dylib */pd-darwin/release-shared/*.opp


gem_clean:


pd_clean:
	-$(MAKE) $(pd_src)/src $(DEST_PATHS) clean


# these targets are all from Makefile.buildlayout: install_clean cruft_clean
clean: abstractions_clean doc_clean externals_clean flext_clean gem_clean \
pd_clean 
	echo "Complete clean finished."


distclean: clean cruft_clean
	$(MAKE) -C $(abstractions_src) distclean
	$(MAKE) -C $(doc_src) distclean
	$(MAKE) -C $(extensions_src) distclean
	$(MAKE) -C $(externals_src) distclean
	-$(MAKE) -C $(pd_src) distclean

test_locations:
	@echo "PD_VERSION: $(PD_VERSION)"
	@echo "PACKAGE_VERSION: $(PACKAGE_VERSION)"
	@echo "CWD $(CWD)"
	@echo "DESTDIR $(DESTDIR)"
	@echo "PREFIX $(prefix)"
	@echo "BINDIR  $(bindir)"
	@echo "LIBDIR  $(libdir)"
	@echo "OBJECTSDIR  $(objectsdir)"
	@echo "PDDOCDIR  $(pddocdir)"
	@echo "LIBPDDIR  $(libpddir)"
	@echo "LIBPDBINDIR  $(libpdbindir)"
	@echo "HELPDIR  $(helpdir)"
	@echo "MANUALSDIR  $(manualsdir)"
	@echo "EXAMPLESDIR  $(examplesdir)"