-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (28 loc) · 948 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This is the Makefile used to generate the attractor.h and attractor.c
# files and run tests. Please ignore it.
CC = gcc
CFLAGS = -Wall -Wextra -Wno-unused-parameter -std=c11
SRC_DIR = .
TEST_DIR = tests
BIN_DIR = bin
# Source files
ATTRACTOR_H = $(SRC_DIR)/attractor.h
ATTRACTOR_C = $(SRC_DIR)/attractor.c
TEST_SRCS = $(wildcard $(TEST_DIR)/*.c)
TEST_OBJS = $(patsubst $(TEST_DIR)/%.c, $(BIN_DIR)/%.o, $(TEST_SRCS))
# Executable name
TEST_EXECUTABLE = $(BIN_DIR)/test
all: $(TEST_EXECUTABLE)
$(ATTRACTOR_H):
node scripts/generate-decl.js > $(ATTRACTOR_H)
$(ATTRACTOR_C): $(ATTRACTOR_H)
node scripts/generate-decl.js c > $(ATTRACTOR_C)
$(BIN_DIR)/%.o: $(TEST_DIR)/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(TEST_EXECUTABLE): $(ATTRACTOR_C) $(TEST_OBJS)
$(CC) $(CFLAGS) $(INCLUDES) $^ -o $@
test: $(TEST_EXECUTABLE)
$(TEST_EXECUTABLE)
clean:
rm -f $(ATTRACTOR_H) $(ATTRACTOR_C) $(TEST_OBJS) $(TEST_EXECUTABLE)
.PHONY: all clean