Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / examples / ffi / Makefile
CommitLineData
7f918cf1
CE
1## Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 # Jagannathan, and Stephen Weeks.
3 # Copyright (C) 1997-2000 NEC Research Institute.
4 #
5 # MLton is released under a BSD-style license.
6 # See the file MLton-LICENSE for details.
7 ##
8
9PATH := ../../../build/bin:$(shell echo $$PATH)
10mlton := mlton -default-ann 'allowFFI true'
11
12.PHONY: all all-win32
13all-win32: import import2 export test_quot
14 ./import
15 ./import2
16 ./export
17 ./test_quot
18all: all-win32 iimport
19 ./iimport
20
21export: export.sml ffi-export.o
22import: import.sml ffi-import.o
23import2: import2.sml ffi-import.o
24test_quot : test_quot.sml c_quot.o
25
26ffi-import.o: export.h
27ffi-export.o: export.h
28c_quot.o : test_quot.h
29
30iimport: iimport.sml
31 $(mlton) \
32 -target-link-opt linux -ldl \
33 -target-link-opt solaris -ldl \
34 iimport.sml
35
36%.o: %.c
37 gcc -Wall -c -o $@ $<
38%.h: %.sml
39 $(mlton) -export-header $@ -stop tc $<
40%:
41 $(mlton) -output $@ $^
42
43clean:
44 ../../../bin/clean