-
Notifications
You must be signed in to change notification settings - Fork 51
/
Makefile.in
80 lines (63 loc) · 1.76 KB
/
Makefile.in
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
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright © 2014 Jesse 'Jeaye' Wilkerson
# See licensing in LICENSE file, or at:
# http://www.opensource.org/licenses/MIT
#
# File: Makefile.in
# Author: Jesse 'Jeaye' Wilkerson
SOURCES=src/main.cpp
OBJ_DIR=obj/
CPP_OBJECTS=$(SOURCES:.cpp=.cpp.o)
OBJECTS=$(CPP_OBJECTS)
BIN_OBJECTS=$(foreach obj,$(OBJECTS), $(addprefix $(OBJ_DIR), $(obj)))
BIN=bin/stdman
# Generation/Installation
PREFIX=%PREFIX%
DATAROOTDIR=%DATAROOTDIR%
MANDIR=%MANDIR%
REFERENCE=%REFERENCE%
TMP_MAN=%TMP_MAN%
THREADS=%THREADS%
CXX=c++
CXX_WARN=-Wall -Wextra -pedantic
CXX_NOWARN=
CXX_OPT=-O3
CXX_INCLUDE=-I src
CXX_PLATFORM_FLAGS=%CXX_PLATFORM_FLAGS%
CXX_FLAGS=-std=c++11 $(CXX_WARN) $(CXX_NOWARN) $(CXX_OPT) $(CXX_INCLUDE) $(CXX_PLATFORM_FLAGS) -c
LD_PLATFORM_LIBS=%LD_PLATFORM_LIBS%
LD_LIBS=-lcurl $(LD_PLATFORM_LIBS)
STDMAN_VERSION=$(shell date +"%Y.%m.%d")
CXX_FLAGS:=$(CXX_FLAGS) -DSTDMAN_VERSION=$(STDMAN_VERSION)
.PHONY: all setup clean stdman stdman_setup stdman_link generate install
.SILENT:
all: stdman
echo "Success"
setup: clean
echo "Preparing"
mkdir -p $(OBJ_DIR) bin man tmp
clean:
rm -f bin/stdman
rm -rf $(OBJ_DIR)
echo "Cleaned"
stdman: stdman_setup stdman_link
echo "Done building stdman"
stdman_setup: setup
echo "Building stdman"
stdman_link: stdman_setup $(OBJECTS)
echo " Linking"
$(CXX) -o $(BIN) $(BIN_OBJECTS) $(LD_LIBS)
%.cpp.o: %.cpp stdman_setup
echo " Compiling $<"
mkdir -p $(addprefix $(OBJ_DIR),$(dir $<))
$(CXX) $(CXX_FLAGS) $< -o $(addsuffix .o,$(addprefix $(OBJ_DIR), $<))
generate: stdman
export tmp_man=$(TMP_MAN) &&\
export reference=$(REFERENCE) &&\
export threads=$(THREADS) &&\
./do_generate
rm -f $(TMP_MAN)/*.html
install:
export tmp_man=$(TMP_MAN) &&\
export reference=$(REFERENCE) &&\
export mandir=$(DESTDIR)$(MANDIR) &&\
./do_install