aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/Makefile
blob: 979358ca0f5eb45e1715b0497cdd535836075ce4 (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
#!/usr/bin/make
# $Id: Makefile 3748 2008-06-02 17:45:25Z matju $

include config.make
COMMON_DEPS = config.make Makefile base/source_filter.rb
RUBY = ruby

#--------#

SHELL = /bin/sh
LDSHARED = $(CXX) $(PDBUNDLEFLAGS)
RM = rm -f
CFLAGS += -Wall -Wno-unused -Wunused-variable -g -fPIC -I.

# LDFLAGS += ../gem-cvs/Gem/Gem.pd_linux

LDSOFLAGS += -lm $(LIBS)
OBJS2 = base/grid.o base/flow_objects.o base/number.1.o base/number.2.o base/number.3.o base/number.4.o format/main.o
SYSTEM = $(shell uname -s | sed -e 's/^MINGW.*/NT/')
FILT = $(RUBY) -w base/source_filter.rb
ifeq ($(OS),darwin)
  PDSUF = .pd_darwin
  PDBUNDLEFLAGS = -bundle -flat_namespace -undefined suppress
else
  ifeq ($(OS),nt)
    PDSUF = .dll
    PDBUNDLEFLAGS = -shared
  else
    PDSUF = .pd_linux
    PDBUNDLEFLAGS = -shared -rdynamic
  endif
endif
PD_LIB = gridflow$(PDSUF)

all:: $(PD_LIB) deprecated

.SUFFIXES:

H = gridflow.h.fcs

%.h.fcs: %.h $(COMMON_DEPS)
	$(FILT) $< $@
%.c.fcs: %.c $(COMMON_DEPS) $(H)
	$(FILT) $< $@
%.m.fcs: %.m $(COMMON_DEPS) $(H)
	$(FILT) $< $@
%.o: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -c $< -o $@
%.1.o: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -DPASS1 -c $< -o $@
%.2.o: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -DPASS2 -c $< -o $@
%.3.o: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -DPASS3 -c $< -o $@
%.4.o: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -DPASS4 -c $< -o $@
%.o: %.m.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -xobjective-c++ -c $< -o $@

%.s: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -S $< -o $@
%.e: %.c.fcs $(COMMON_DEPS) $(H)
	$(CXX) $(CFLAGS) -E $< -o $@

.PRECIOUS: %.h.fcs %.c.fcs %.m.fcs

base/mmx.asm base/mmx_loader.c: base/mmx.rb
	$(RUBY) base/mmx.rb base/mmx.asm base/mmx_loader.c
base/mmx.o: base/mmx.asm
	nasm -f elf base/mmx.asm -o base/mmx.o

unskew::
	find . -mtime -0 -ls -exec touch '{}' ';'

$(PD_LIB): gridflow.c.fcs $(OBJS2) $(OBJS) $(H) $(COMMON_DEPS)
	$(CXX) -DPDSUF=\"$(PDSUF)\" -Ibundled/pd $(LDSOFLAGS) $(CFLAGS) $(PDBUNDLEFLAGS) $(LIBPATH) \
		gridflow.c.fcs -xnone $(OBJS2) $(OBJS) -o $@

beep::
	@for z in 1 2 3 4 5; do echo -ne '\a'; sleep 1; done

install::
	@echo -e "\033[0;1;33;41m"
	@echo -e "1. move this folder to lib/pd/extra or add the folder to -path"
	@echo -e "2. delete the old gridflow.pd_linux"
	@echo -e "3. and don't do \"make install\" anymore\033[0m\n"

DEPRECATED = camera_control motion_detection color mouse fade scale_to \
	apply_colormap_channelwise checkers contrast posterize ravel remap_image solarize spread \
	rgb_to_greyscale greyscale_to_rgb rgb_to_yuv yuv_to_rgb rotate in out

deprecated:: deprecated/@fade.pd deprecated/@!.pd doc/flow_classes/@complex_sq-help.pd

deprecated/@fade.pd: abstractions/\#fade.pd
	for z in $(DEPRECATED); do cp abstractions/\#$$z.pd deprecated/\@$$z.pd; done

deprecated/@!.pd: deprecated/0x40!.pd
	for z in complex_sq convolve fold inner \! scan; do cp deprecated/0x40$$z.pd deprecated/@$$z.pd; done

doc/flow_classes/@complex_sq-help.pd: doc/flow_classes/0x40complex_sq-help.pd
	for z in complex_sq join; do cp doc/flow_classes/0x40$$z-help.pd doc/flow_classes/@$$z-help.pd; done

clean::
	@-$(RM) gridflow.pd_linux *.o */*.o *.so
	rm -f $(OBJS2) $(OBJS) base/*.fcs format/*.fcs optional/*.fcs \
		$(patsubst %,deprecated/@%.pd,$(DEPRECATED))

#--------#--------#--------#--------#--------#--------#--------#--------

help::
	@echo "do one of the following:";\
	echo  "make all            compiles gridflow";\
	echo  "make beep           beeps";\
	echo  "make unskew         removes timestamps in the future (if you have clock issues)"

#--------#--------#--------#--------#--------#--------#--------#--------

kloc::
	wc configure base/*.rb