-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
74 lines (56 loc) · 1.69 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
# Winds - package manager for Cyclone Scheme
# Copyright (c) 2020, Cyclone Team
# All rights reserved.
# Commands
CYCLONE = cyclone
INSTALL ?= install
RM ?= rm -f
# Directories
PREFIX ?= /usr/local
DEST_DIR = $(PREFIX)/bin
LIBS_DIR = libs
TESTS_DIR = tests
SYS_DIR = sys
BOOTSTRAP_DIR = ../cyclone-bootstrap
# Files
WINDS_SRC = winds.scm
LIBS = util common metadata file system-calls lock semantic index package
LIBS_SRC = $(LIBS:%=$(LIBS_DIR)/%.sld)
TESTS_SRC = $(wildcard $(TESTS_DIR)/*.scm)
SYS_SRC = $(SYS_DIR)/tasks.scm
# Output
WINDS_BN = $(basename $(WINDS_SRC))
LIBS_BN = $(LIBS_SRC:.sld=.so)
TESTS_BN = $(basename $(TESTS_SRC))
SYS_BN = $(basename $(SYS_SRC))
#Rules
all : $(WINDS_BN)
$(WINDS_BN) : $(LIBS_BN) $(WINDS_SRC)
$(CYCLONE) $(WINDS_SRC)
$(LIBS_BN) : %.so : %.sld
$(CYCLONE) $<
$(TESTS_BN) : % : %.scm
$(CYCLONE) $<
$(SYS_BN) :
$(CYCLONE) $(SYS_SRC)
.PHONY: run-tests test clean install uninstall full run-sys-tasks sys-tasks bootstrap
run-tests : $(TESTS_BN)
./$<
test : all run-tests
run-sys-tasks : $(SYS_BN)
./$<
sys-tasks: all run-sys-tasks
clean :
$(RM) $(WINDS_BN) *.a *.out *.so *.o *.c *.meta tags
$(RM) $(LIBS_DIR)/*.so $(LIBS_DIR)/*.o $(LIBS_DIR)/*.c $(LIBS_DIR)/*.meta
$(RM) $(TESTS_DIR)/*.so $(TESTS_DIR)/*.o $(TESTS_DIR)/*.c $(TESTS_DIR)/*.meta $(TESTS_BN)
$(RM) $(SYS_DIR)/*.so $(SYS_DIR)/*.o $(SYS_DIR)/*.c $(SYS_DIR)/*.meta $(SYS_BN)
install : $(WINDS_BN)
$(INSTALL) -m0755 $(WINDS_BN) $(DEST_DIR)
uninstall :
$(RM) $(DEST_DIR)/$(WINDS_BN)
full :
$(MAKE) clean; $(MAKE) && sudo $(MAKE) install && $(MAKE) test
bootstrap: winds
cp winds.c $(BOOTSTRAP_DIR)/tools/winds/
cp libs/*.c $(BOOTSTRAP_DIR)/tools/winds/libs/