-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
151 lines (118 loc) · 3.83 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
##
#
# @gaelfoppolo FOPPOLO Gaël
# @Ebatsin PHILIP Bastien
#
# @brief Makefile
#
# @see README for further instructions
#
##
###################################################
# Variables:
###################################################
CC = javac
RUN = java
CCD = doxygen
LIB = lib
SRC = src
CLASS = class
DOC = docs
RESOURCES = resources
DATA = data
PRESENTATION = presentation
FLAGS_CC = -Xdiags:verbose
RM = rm -rf
# packages
PACKAGE = locomotor
PACKAGE_CORE = $(PACKAGE).core.Main
PACKAGE_FRONT_USER = $(PACKAGE).front.user.Main
PACKAGE_FRONT_ADMIN =
MAIN = Main.java
# paths
COMPONENTS = $(PACKAGE)/components
COMPONENTS_TYPES = $(COMPONENTS)/types
COMPONENTS_MODELS = $(COMPONENTS)/models
CORE = $(PACKAGE)/core
FRONT = $(PACKAGE)/front
INT_COMPONENTS = $(FRONT)/components
INT_ADMIN = $(FRONT)/administration
INT_USER = $(FRONT)/user
# lib
LIBALL = $(LIB)/*
CHK_STY = $(LIB)/checkstyle-7.3-all.jar
CHK_STY_CONF = $(LIB)/google_checks.xml
DOC_CONF = doxygen.cfg
#TODO: handle windows
###################################################
# Targets:
###################################################
all: build-core build-front-user
build-components: linter-components build-components-types build-components-models
build-components-types:
$(CC) -d $(CLASS) -sourcepath $(SRC) -classpath "$(LIBALL):$(CLASS):" $(FLAGS_CC) $(SRC)/$(COMPONENTS_TYPES)/*.java
build-components-models:
$(CC) -d $(CLASS) -sourcepath $(SRC) -classpath "$(LIBALL):$(CLASS):" $(FLAGS_CC) $(SRC)/$(COMPONENTS_MODELS)/*.java
build-core: linter-core
-test -d $(CLASS) || mkdir $(CLASS)
$(CC) -d $(CLASS) -sourcepath $(SRC) -classpath "$(LIBALL):$(CLASS):" $(FLAGS_CC) $(SRC)/$(CORE)/$(MAIN)
build-front-user:
-test -d $(CLASS) || mkdir $(CLASS)
$(CC) -d $(CLASS) -sourcepath $(SRC) -classpath "$(LIBALL):$(CLASS):$(RESOURCES):" $(FLAGS_CC) $(SRC)/$(INT_USER)/$(MAIN)
run-core:
$(RUN) -classpath "$(LIB)/*:$(CLASS)" $(PACKAGE_CORE) $(ARGS)
run-front-user:
$(RUN) -classpath "$(LIB)/*:$(CLASS):$(RESOURCES):" $(PACKAGE_FRONT_USER) $(ARGS)
###################################################
# Doc:
###################################################
.PHONY: doc
doc:
test -d $(DOC) || mkdir $(DOC)
$(CCD) $(DOC_CONF)
###################################################
# Housekeeping:
###################################################
.PHONY: clean
clean: clean-components clean-core clean-front clean-doc
.PHONY: clean-components
clean-components:
$(RM) $(CLASS)/$(COMPONENTS)/*
.PHONY: clean-core
clean-core:
$(RM) $(CLASS)/$(CORE)/*
.PHONY: clean-front
clean-front:
$(RM) $(CLASS)/$(FRONT)/*
.PHONY: clean-doc
clean-doc:
mv $(DOC)/$(PRESENTATION) $(PRESENTATION)
$(RM) $(DOC)/*
mv $(PRESENTATION) $(DOC)/$(PRESENTATION)
###################################################
# Lintering:
###################################################
.PHONY: linter
linter: linter-components linter-core linter-front
.PHONY: linter-core
linter-core: linter-components
$(RUN) -jar $(CHK_STY) -c $(CHK_STY_CONF) $(SRC)/$(CORE)
.PHONY: linter-components
linter-components:
$(RUN) -jar $(CHK_STY) -c $(CHK_STY_CONF) $(SRC)/$(COMPONENTS)
.PHONY: linter-front
linter-front: linter-components linter-front-components linter-front-user
.PHONY: linter-front-components
linter-front-components:
$(RUN) -jar $(CHK_STY) -c $(CHK_STY_CONF) $(SRC)/$(INT_COMPONENTS)
.PHONY: linter-front-user
linter-front-user:
$(RUN) -jar $(CHK_STY) -c $(CHK_STY_CONF) $(SRC)/$(INT_USER)
###################################################
# Database:
###################################################
DATAJSON = $(shell echo $(DATA)/*.json)
import-database:
$(foreach file, $(DATAJSON), mongoimport -d $(PACKAGE) -c $(shell basename $(file) .json) --drop --file $(file);)
export-database:
$(foreach file, $(DATAJSON), mongoexport -d $(PACKAGE) -c $(shell basename $(file) .json) --out $(file) --pretty;)