-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (51 loc) · 1.65 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
DIRS = Poly.Internals PolyCompiler Runtime BCL Testing mono-compat
export PREFIX = /usr/local
CC=gcc
CFLAGS=-ggdb
AR=ar
POLYFLAGS=
ifndef ARCH
export ARCH = $(shell uname -m)
endif
ifeq ($(ARCH), x86_64)
CFLAGS += -m64
POLYFLAGS += --arch=X64
else
CFLAGS += -m32
POLYFLAGS += --arch=X86
endif
export CFLAGS
export POLYFLAGS
.PHONY: force clean install libs
all: $(DIRS)
clean_DIRS=$(addprefix clean_, $(DIRS))
clean: $(clean_DIRS)
$(clean_DIRS): force
make -C $(patsubst clean_%, %, $@) clean
$(DIRS): force
make -C $@
libs: all
mkdir -p libs
mono PolyCompiler/Build/PolyCompiler.exe $(POLYFLAGS) BCL/mscorlib/Build/__mscorlib.dll --out=libs
mono PolyCompiler/Build/PolyCompiler.exe $(POLYFLAGS) Poly.Internals/Build/Poly.Internals.dll --out=libs
$(CC) -IRuntime libs/mscorlib.c -c -o libs/mscorlib.obj $(CFLAGS)
$(CC) -IRuntime libs/Poly.Internals.c -c -o libs/Poly.Internals.obj $(CFLAGS)
install: all libs
mkdir -p $(PREFIX)/lib/poly
mkdir -p $(PREFIX)/lib/poly/bin
mkdir -p $(PREFIX)/lib/poly/lib
mkdir -p $(PREFIX)/lib/poly/include
cp Runtime/*.h $(PREFIX)/lib/poly/include
cp libs/*.h $(PREFIX)/lib/poly/include
cp PolyCompiler/Build/PolyCompiler.exe $(PREFIX)/lib/poly/bin
cp Poly.Internals/Build/Poly.Internals.dll $(PREFIX)/lib/poly/bin
cp Poly.Internals/Build/Poly.Internals.dll $(PREFIX)/lib/poly/lib
cp libs/Poly.Internals.obj $(PREFIX)/lib/poly/lib
cp BCL/mscorlib/Build/__mscorlib.dll $(PREFIX)/lib/poly/lib
cp libs/mscorlib.obj $(PREFIX)/lib/poly/lib
cp Runtime/runtime.a $(PREFIX)/lib/poly/lib
cp mono-compat/polyc $(PREFIX)/lib/poly/bin
cp mono-compat/polyc $(PREFIX)/bin
uninstall:
rm -rf $(PREFIX)/poly
rm -rf $(PREFIX)/bin/polyc