-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (34 loc) · 1.14 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
# Copyright (c) 2014, Philip Xu <[email protected]>
# All rights reserved.
# License: BSD New, see LICENSE for details.
PROGRAM ?= 2048-ml
BUILD_DIR = _build
SRC_DIR = src
TARGET = main
DEBUG_TARGET = $(TARGET).byte
RELEASE_TARGET = $(TARGET).native
RELEASE_BUILD_OUTPUT = $(BUILD_DIR)/$(SRC_DIR)/$(RELEASE_TARGET)
# install dest.
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
SRC = $(wildcard $(realpath $(SRC_DIR))/*.mli) $(wildcard $(realpath $(SRC_DIR))/*.ml)
FLAGS := -I $(SRC_DIR) -cflags "-w A-4-33-40-41-42-43-34-44" -cflag -strict-sequence -cflag -annot $(FLAGS)
DEBUG_FLAGS := -cflag -g $(DEBUG_FLAGS)
LIBS := -libs graphics $(LIBS)
OCAMLBUILD ?= ocamlbuild
.PHONY: all debug release run install uninstall clean
all: release
debug: $(SRC)
$(OCAMLBUILD) $(FLAGS) $(DEBUG_FLAGS) $(LIBS) $(SRC_DIR)/$(DEBUG_TARGET)
release: $(SRC)
$(OCAMLBUILD) $(FLAGS) $(LIBS) $(SRC_DIR)/$(RELEASE_TARGET)
run: debug
./$(DEBUG_TARGET)
install: release
install -d $(DESTDIR)$(bindir)
install -m 0755 $(RELEASE_BUILD_OUTPUT) $(DESTDIR)$(bindir)/$(PROGRAM)
uninstall:
-rm $(DESTDIR)$(bindir)/$(PROGRAM)
clean:
$(OCAMLBUILD) -clean