Makefile 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk

ifeq "$(WINDOWS)" "YES"
DLL = lib$1.dll
else ifeq "$(DARWIN)" "YES"
DLL = lib$1.dylib
else
DLL = lib$1.so
endif

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
ifeq "$(WINDOWS)" "YES"
EXE = $1.exe
else ifeq "$(DARWIN)" "YES"
EXE = $1
else
EXE = $1
endif

ifeq "$(WINDOWS)" "YES"
CFLAGS =
else
CFLAGS = -fPIC
endif

MY_TEST_HC_OPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS)) $(CFLAGS)
28 29 30 31 32

.PHONY: load_short_name
load_short_name:
	rm -rf bin_short
	mkdir bin_short
33
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_short" -shared A.c -o "bin_short/$(call DLL,A)"
34 35
	rm -f bin_short/*.a
	echo ":q" | "$(TEST_HC)" --interactive -L"./bin_short" -lA -v0
36 37 38

.PHONY: compile_libAS
compile_libAS:
39 40 41 42 43 44 45
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -shared A.c -o $(call DLL,AS)
	rm -f libAS*.a

.PHONY: compile_libAB_dep
compile_libAB_dep:
	rm -rf bin_dep
	mkdir bin_dep
46 47
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dep" -shared A.c -o "bin_dep/$(call DLL,A)"
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dep" -shared B.c -o "bin_dep/$(call DLL,B)" -lA -L"./bin_dep"
48 49 50 51 52 53
	rm -f bin_dep/*.a

.PHONY: compile_libAB_dyn
compile_libAB_dyn:
	rm -rf bin_dyn
	mkdir bin_dyn
54 55
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared A.c -o "bin_dyn/$(call DLL,A)"
	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared B.c -o "bin_dyn/$(call DLL,B)" -lA -L"./bin_dyn"
56 57 58 59 60 61
	rm -f bin_dyn/*.a
	'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -v0 -o "bin_dyn/$(call EXE,T10955dyn)" -L./bin_dyn -lB -lA T10955dyn.hs -v0
	LD_LIBRARY_PATH=./bin_dyn ./bin_dyn/$(call EXE,T10955dyn)

.PHONY: T1407
T1407:
62 63 64 65
	cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" $(TEST_HC_OPTS) -ignore-dot-ghci -v0 --interactive -L.

.PHONY: T3242
	echo ":q" | '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0 -lm