hsext loader using Pd path
[pdhaskell:hsext.git] / Makefile
1 # hsext -- Haskell objects for Pd
2 # Copyright (C) 2007 Claude Heiland-Allen
3
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19 PDSRC = $(HOME)/src/pd-0.40-2/src
20
21 CFLAGS = -I$(PDSRC) -I/usr/lib/ghc-6.4.2/include -I./build -Wall
22 HCFLAGS = -I$(PDSRC)
23 #HFLAGS = -odir ./build -hidir ./build -stubdir ./build -Wall -fffi
24 HFLAGS = -i./api -i./hsext -i./build -odir ./build -hidir ./build -Wall -fffi
25 #
26
27 all: hsext.pd_linux
28
29 clean:
30         rm -f build/bootstrap.o build/HsExt.hi build/HsExt.o \
31 build/HsExt_stub.c build/HsExt_stub.h build/HsExt_stub.o build/libhsext.o \
32 build/Pd.hi build/Pd.o build/PdStructs.hi build/PdStructs.hs build/PdStructs.o \
33 build/PureData.hi build/PureData.o
34
35 dist-clean:
36         rm -f hsext.pd_linux
37
38 #
39
40 hsext.pd_linux: build/bootstrap.o build/HsExt.o build/HsExt_stub.o build/Pd.o build/PdStructs.o build/libhsext.o build/PureData.o
41         ghc $(HFLAGS) -no-hs-main -package plugins -optl -shared -o hsext.pd_linux build/bootstrap.o build/HsExt.o build/HsExt_stub.o build/Pd.o build/PdStructs.o build/libhsext.o build/PureData.o
42
43 build/HsExt.o build/Pd.o build/PdStructs.o build/HsExt_stub.h build/HsExt_stub.o: hsext/HsExt.hs hsext/Pd.hs api/PureData.hs hsext/libhsext.h build/PdStructs.hs
44         ghc $(HFLAGS) -no-hs-main --make -c hsext/HsExt.hs
45         mv -f hsext/HsExt_stub.c build/HsExt_stub.c
46         mv -f hsext/HsExt_stub.h build/HsExt_stub.h
47         cp -f build/PureData.hi  api/PureData.hi
48         cp -f build/PdStructs.hi api/PdStructs.hi
49         cp -f build/Pd.hi        api/Pd.hi
50
51 build/PdStructs.hs: hsext/PdStructs.hsc
52         hsc2hs $(HCFLAGS) -o build/PdStructs.hs hsext/PdStructs.hsc
53
54 build/libhsext.o: hsext/libhsext.c hsext/libhsext.h
55         gcc $(CFLAGS) -c -o build/libhsext.o hsext/libhsext.c
56
57 build/bootstrap.o: hsext/bootstrap.c build/HsExt_stub.h
58         gcc $(CFLAGS) -c -o build/bootstrap.o hsext/bootstrap.c