-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
78 lines (60 loc) · 2.22 KB
/
Makefile
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
BIN=bin
TARGET=$(BIN)/smackage
MLTON=mlton
SMLNJ=sml
POLYML := $(shell { command -v poly || echo polyml; } 2>/dev/null)
POLYML_LDFLAGS := $(shell { pkg-config --libs polyml || echo -lpolymain -lpolyml; } 2>/dev/null)
MLKIT=mlkit
SMLSHARP=smlsharp
SMLSHARP_MODULES_=$(wildcard src/*.smi) $(wildcard util/*.smi)
SMLSHARP_MODULES=$(SMLSHARP_MODULES_:.smi=.sml)
SMLSHARP_CFLAGS=-O2
SMLSHARP_LDFLAGS=
smlsharp_sources:=$(SMLSHARP_MODULES)
smlsharp_objects:=$(smlsharp_sources:.sml=.o)
all:
@echo "== Smackage Installation =="
@echo "Run 'make mlton', 'make smlnj', 'make polyml', 'make mlkit' or 'make smlsharp' on Linux/Unix/OSX."
@echo "Run 'make win+smlnj' or 'make win+mlton' on Windows."
@echo "In Smackage, then run 'make install' to install."
false
mlton:
$(MLTON) -output $(TARGET) smack.mlb
win+mlton:
$(MLTON) -output $(TARGET) smack-nonposix.mlb
smlnj:
$(SMLNJ) src/go-nj.sml
bin/.mkexec `which sml` `pwd` smackage
win+smlnj:
$(SMLNJ) src/go-nj-nonposix.sml
bin/.mkexec-win `which sml` `pwd` smackage
polyml:
$(POLYML) < src/poly_build.sml
$(CC) -o $(BIN)/smackage $(BIN)/polyml-smackage.o $(POLYML_LDFLAGS)
mlkit:
$(MLKIT) -o $(BIN)/smackage smack.mlb
smlsharp: $(smlsharp_objects)
$(SMLSHARP) $(SMLSHARP_LDFLAGS) $(SMLSHARP_FLAGS) -o $(TARGET) src/go.smi
%.o: %.sml
$(SMLSHARP) $(SMLSHARP_CFLAGS) $(SMLSHARP_FLAGS) -c -o $@ $<
clean:
rm -f $(BIN)/smackage
rm -f $(smlsharp_objects)
smackage-install:
@echo "NOTICE: This is probably not the command you meant to run."
@echo "If you are invoking this makefile through smackage by"
@echo "running `smackage make smackage smackage-install', then in the"
@echo "future you should run `smackage make smackage install' instead."
@echo ""
@echo "This version still works if you want to run `make' directly"
@echo "instead of invoking it indirectly (`smackage make smackage')."
@echo "However, the latter option is suggested."
rm -f ../../../bin/smackage.new
cp $(BIN)/smackage ../../../bin/smackage.new
mv ../../../bin/smackage.new ../../../bin/smackage
install:
mkdir -p $(DESTDIR)/bin
rm -f $(DESTDIR)/bin/smackage.new
cp $(BIN)/smackage $(DESTDIR)/bin/smackage.new
mv $(DESTDIR)/bin/smackage.new $(DESTDIR)/bin/smackage
.PHONY: clean mlton smlnj polyml mlkit smlsharp