-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (49 loc) · 1.82 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
-include config.mk
ifeq ($(BINARIES),)
$(error 'config.mk' is missing, run ./configure)
endif
VERSION := 0.3.3
SRC_DIR := src
INCLUDE_DIR := include
BIN_DIR := bin
MAN_DIR := man
DOCS_DIR := docs
ASSETS_DIR := assets
TOOLS_DIR := tools
TARGET_DIR := target
TARGET_OBJECT_DIR := $(TARGET_DIR)/obj
TARGET_BIN_DIR := $(TARGET_DIR)/bin
TARGET_MAN_DIR := $(TARGET_DIR)/man
TARGET_DOCS_DIR := $(TARGET_DIR)/docs
TARGET_ASSETS_DIR := $(TARGET_DOCS_DIR)/assets
TARGET_DIRS := $(TARGET_DIR) $(TARGET_OBJECT_DIR) $(TARGET_BIN_DIR) \
$(TARGET_DOCS_DIR) $(TARGET_MAN_DIR)
SOURCE_FILES := $(wildcard $(SRC_DIR)/*.c)
EXEC_FILES := $(wildcard $(BIN_DIR)/*)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(TARGET_OBJECT_DIR)/%.o,$(SOURCE_FILES))
BIN_FILES := $(patsubst %,$(TARGET_BIN_DIR)/%,$(BINARIES))
INCLUDE_FILES := $(wildcard $(INCLUDE_DIR)/*.h)
MAN_FILES := $(wildcard $(MAN_DIR)/*.txt)
TEMPL_FILES := $(wildcard $(DOCS_DIR)/*.txt)
ROFF_FILES := $(patsubst $(MAN_DIR)/%.txt,$(TARGET_MAN_DIR)/%,$(MAN_FILES))
DOCS_FILES := $(patsubst $(DOCS_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(TEMPL_FILES)) \
$(patsubst $(MAN_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(MAN_FILES))
CFLAGS += -I$(INCLUDE_DIR) -I. -DSV_VERSION=\"$(VERSION)\" -g -std=gnu99
LDFLAGS +=
ifeq ($(VERBOSE),)
SILENT := @
endif
# Magic targets
.PHONY: all clean manual binary documentation
.PRECIOUS: $(OBJ_FILES) $(patsubst $(BIN_DIR)/%.c,$(TARGET_OBJECT_DIR)/%.o,$(EXEC_FILES))
# Default target
all: compile_flags.txt binary manual documentation
# Clean target
clean:
@echo "[ RM ] $(TARGET_DIRS)"
$(SILENT)rm -rf $(TARGET_DIRS)
binary: $(BIN_FILES)
manual: $(ROFF_FILES)
documentation: $(DOCS_FILES)
include mk/target.mk
include mk/install.mk