-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
51 lines (39 loc) · 1.03 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
ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
JULIA ?= julia
DLEXT := $(shell $(JULIA) --startup-file=no -e 'using Libdl; print(Libdl.dlext)')
PREFIX := $(ROOT_DIR)/target
LIBDIR := $(PREFIX)/lib
BINDIR := $(PREFIX)/bin
MAIN_C := $(BINDIR)/main-c
MAIN_RS := $(BINDIR)/main-rs
ifeq ($(OS), Windows)
LIBDIR := $(BINDIR)
MAIN_C := $(BINDIR)/main-c.exe
MAIN_RS := $(BINDIR)/main-rs.exe
endif
LIBCG := $(LIBDIR)/libcg.$(DLEXT)
SUBDIRS := CG main-c main-rs
.PHONY: all $(SUBDIRS)
all: $(MAIN_C) $(MAIN_RS)
CG: $(LIBCG)
main-c: $(MAIN_C)
main-rs: $(MAIN_RS)
$(LIBCG):
$(MAKE) -C CG
PREFIX=$(PREFIX) $(MAKE) -C CG install
$(MAIN_C): $(LIBCG)
$(MAKE) -C main-c
PREFIX=$(PREFIX) $(MAKE) -C main-c install
$(MAIN_RS): $(LIBCG)
$(MAKE) -C main-rs build-release
PREFIX=$(PREFIX) $(MAKE) -C main-rs install
.PHONY: clean
clean:
$(MAKE) -C CG clean
$(MAKE) -C main-c clean
$(MAKE) -C main-rs clean clean-release
.PHONY: distclean
distclean: clean
$(MAKE) -C CG distclean
$(MAKE) -C main-rs distclean
$(RM) -Rf $(ROOT_DIR)/target