summaryrefslogtreecommitdiffstats
path: root/final_project/work/Makefile
blob: f8e8f97bb53016c405eb2b5e13f87e6e970abff0 (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
all:
	rm -f prhello-shim.{c,o} prhello-const.{c,o} *.bin *.so
	make install-example
	mit-scheme --batch-mode --load prhello.scm

run:
	rm -f prhello-shim.{c,o} prhello-const.{c,o} *.bin *.so
	make install-example
	mit-scheme  --load prhello.scm


install-example: build-example
	sudo cp -a prhello-types.bin /usr/local/lib/mit-scheme/lib/.
	sudo cp -a  prhello-const.bin /usr/local/lib/mit-scheme/lib/.
	sudo cp -a  prhello-shim.so /usr/local/lib/mit-scheme/lib/.

build-example: prhello-shim.so prhello-types.bin prhello-const.bin

prhello-shim.so: prhello-shim.o
	$(CC) -shared -fPIC -o $@ $^ `pkg-config --libs gtk+-2.0`

prhello-shim.o: prhello-shim.c
	$(CC) -I../lib -Wall -fPIC `pkg-config --cflags gtk+-2.0` -o $@ -c $<

prhello-shim.c prhello-const.c prhello-types.bin: prhello.cdecl
	(echo "(load-option 'FFI)"; \
	echo '(C-generate "prhello" "#include <gtk/gtk.h>")') \
	| mit-scheme --batch-mode

prhello-const.bin: prhello-const.scm
	echo '(sf "prhello-const")' | mit-scheme --compiler --batch-mode

prhello-const.scm: prhello-const
	./prhello-const

prhello-const: prhello-const.o
	@rm -f $@
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ `pkg-config --libs gtk+-2.0`

prhello-const.o: prhello-const.c
	$(CC) `pkg-config --cflags gtk+-2.0` $(CFLAGS) -o $@ -c $<