aboutsummaryrefslogtreecommitdiff
path: root/externals/build/win/makefile
blob: 137fb2cf2befe98a62505283607e5cb12f7f7524 (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

# Adapt the PD_PATH if your pd is not installed in the standard place

# path for compiling against an installed version of Pd
#PD_PATH="$(PROGRAMFILES)/pd"
# path for compiling from CVS with the standard developer layout
PD_PATH=../../../pd

STRIP = strip --strip-unneeded -R .note -R .comment

# only try to compile C files
EXTERNALS = $(shell ls ../src | grep -e '.*\.c$$')

# these are little macros for remapping things on Windows which are
# defined on other platforms
WINDOWS_COMPAT_DEFINES = \
	-D'drand48()=((double)rand()/RAND_MAX)' \
	-D'srand48(n)=srand((n))' \
	-D'O_NONBLOCK=1' \
# These don't seem to be needed:
#	-D'bzero(p,n)=memset(p,0,n)' \
#	-D'PROT_READ=1' \
#	-D'MAP_PRIVATE=2' \
#	-D'O_NDELAY=O_NONBLOCK'

DEFINES = -DPD -DNT $(WINDOWS_COMPAT_DEFINES)


# Generic x86 (compile for 686, since that's most common these days)
OPTIM_FLAGS = -O3 -march=i686 -mfpmath=sse -msse
# Pentium
#OPTIM_FLAGS = -O3 -march=pentium
# Pentium MMX
#OPTIM_FLAGS = -O3 -march=pentium-mmx -mmmx
# Pentium Pro
#OPTIM_FLAGS = -O3 -march=pentiumpro -mmmx
# Pentium II/Celeron
#OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium2
# Pentium III/Celeron2
#OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium3
# Pentium 4
#OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -msse2 -march=pentium4

# AMD Athlon XP K7
#OPTIM_FLAGS = -O3 -march=athlon-xp -m3dnow -msse -mfpmath=sse


CFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -Wno-unused -Wno-parentheses \
	 -Wno-switch $(OPTIM_FLAGS)

INCLUDE = -I. -I.. -I$(PD_PATH)/src -IC:/msys/1.0/include
LDFLAGS = -shared -LC:/msys/1.0/lib -L$(PD_PATH)/bin -lpd

all: externals


.SUFFIXES: .dll

externals: $(EXTERNALS:.c=.dll)

%.dll: ../src/%.c
	$(CC) -mms-bitfields $(CFLAGS) $(DEFINES) $(INCLUDE) \
		 -o "$*.o" -c "../src/$*.c"
	gcc $(LDFLAGS) -o "$*.dll" "$*.o" \
		`test -f $*.libs && cat $*.libs` \
		`test -f ../src/$*.libs && cat ../src/$*.libs` 
	$(STRIP) "$*.dll"
	rm "$*.o"

clean:
	-rm *.a *.def *.c *.o *.obj
	rm *.dll

install-doc:
	@test -d $(PD_PATH)/doc/5.reference || mkdir -p $(PD_PATH)/doc/5.reference
	cd ../doc && make all
	cp -r ../doc/* $(PD_PATH)/doc/5.reference

install: install-doc
	@test -d $(PD_PATH)/extra || mkdir -p $(PD_PATH)/extra
	install *.dll $(PD_PATH)/extra