This repository has been archived by the owner on May 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (36 loc) · 1.23 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
RAS_ROOT?=$(shell echo $$HOME)/ras
TEST_DATA?=test_data
RAS_BIN=$(RAS_ROOT)/bin
CC:=$(CXX)
CXXFLAGS='-DRAS_ROOT="$(abspath $(RAS_ROOT))"'
OUTPUT_OPTION=-MMD -MP -o $@
LDLIBS=
######################## Source Code Compilation ##########################
all: ras_server shell
SRC=$(wildcard *.cpp)
OBJ=$(SRC:.cpp=.o)
DEP=$(SRC:.cpp=.d)
-include $(DEP)
.PHONY: clean
ras_server: ras_server.o
shell: $(filter-out ras_server.o, $(OBJ))
clean:
rm -f $(OBJ) $(DEP) ras_server shell
###########################################################################
############################ Test Environment #############################
.PHONY: test
test: clean_commands commands
cp $(TEST_DATA)/test.html $(RAS_ROOT)
###########################################################################
######################## Environment Compilation ##########################
CMD_TARGETS=$(addprefix $(RAS_BIN)/, $(basename $(notdir $(wildcard commands/*.cpp))))
.PHONY: commands clean_commands
commands: $(RAS_BIN) $(CMD_TARGETS)
cp /bin/{cat,ls} $(RAS_BIN)
$(RAS_BIN):
mkdir $(RAS_BIN)
$(RAS_BIN)/%: commands/%.cpp
$(CXX) -o $@ $<
clean_commands:
-rm -f $(RAS_BIN)/* $(RAS_ROOT)/*
###########################################################################