-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
23 lines (19 loc) · 837 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Makefile for building a single configuration of the C interpreter. It expects
# variables to be passed in for:
#
# MODE "debug" or "release".
# NAME Name of the output executable (and object file directory).
# SOURCE_DIR Directory where source files and headers are found.
BUILD_DIR := build
# Files.
HEADERS := $(wildcard $(SOURCE_DIR)/*.h)
SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
OBJECTS := $(addprefix $(BUILD_DIR)/$(NAME)/, $(notdir $(SOURCES:.c=.o)))
# Compile the C interpreter.
default:
@ $(MAKE) -f ./c.make NAME=clox MODE=release SOURCE_DIR=.
@ cp build/clox clox # For convenience, copy the interpreter to the top level.
# Compile a debug build of clox.
debug:
@ $(MAKE) -f ./c.make NAME=cloxd MODE=debug SOURCE_DIR=.
@ cp build/cloxd clox # For convenience, copy the interpreter to the top level.