-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 764 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
GZIP = gzip -9
BUILD_DIR = build
MAN_DIR = /usr/local/share/man
BIN_DIR = /usr/local/bin
SECTION = 1
SRC_FILES = $(wildcard *.go)
ROFF_FILES = $(wildcard doc/*.roff)
MAN_FILES = $(ROFF_FILES:doc/%.roff=$(BUILD_DIR)/%)
MAN_GZ_FILES = $(MAN_FILES:%=%.gz)
OBJ_FILES = $(SRC_FILES:src/%.c=$(BUILD_DIR)/%.o)
all: doc $(BUILD_DIR)/salsa
doc: $(MAN_GZ_FILES)
$(BUILD_DIR)/salsa: $(SRC_FILES)
go build -o build/salsa
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.gz: doc/%.roff $(BUILD_DIR)
$(GZIP) -c $< > $@
install: install-doc install-bin
install-bin: all
install -m 755 build/salsa $(BIN_DIR)
install-doc: $(MAN_GZ_FILES) all
install -d $(MAN_DIR)/man$(SECTION)
install -m 644 $(MAN_GZ_FILES) $(MAN_DIR)/man$(SECTION)
clean:
rm -rf $(BUILD_DIR)