-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmakefile.moss
37 lines (31 loc) · 889 Bytes
/
makefile.moss
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
CXX = g++
AR = ar crv
CXXFLAGS = -std=c++11 -g -O0 -D __MOSS_TEST -Wreturn-type -Wno-narrowing
ifeq ($(PROJ_BASE),)
PROJ_BASE := .
endif
BUILD := $(shell mkdir -p $(PROJ_BASE)/build;cd $(PROJ_BASE)/build;pwd)
APP_DIR := $(shell mkdir -p $(BUILD)/apps;cd $(BUILD)/apps;pwd)
LIBS_DIR := $(shell mkdir -p $(BUILD)/libs;cd $(BUILD)/libs;pwd)
ifeq ($(MAKEFILE_LIB),)
include $(PROJ_BASE)/makefile.libs
endif
ifeq ($(USE_SPEC_SRC),)
SRC_DIRS = $(shell find . -type d)
SRC += $(foreach dir, $(SRC_DIRS), $(wildcard $(dir)/*.cc))
endif
OBJ := $(SRC:%.cc=%.o)
ifeq ($(TARGET_TYPE),EXE)
$(TARGET): $(OBJ)
$(CXX) $(CXXFLAGS) $(LIB_DIR) $(INC) -o $(APP_DIR)/$(TARGET) $(OBJ) $(LIB)
endif
ifeq ($(TARGET_TYPE),LIB)
$(TARGET): $(OBJ)
$(AR) $(LIBS_DIR)/$(TARGET) $(OBJ)
endif
%.o : %.cc
# cpplint $<
$(CXX) $(CXXFLAGS) $(LIB_DIR) $(INC) -o $@ -c $< $(LIB)
.PHONY: clean
clean:
rm -rf $(BUILD)