This repository has been archived by the owner on Sep 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
215 lines (191 loc) · 6.6 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Executables
OSTYPE = $(shell uname -s)
JAVAC = javac
JAVA = java
A2PS = a2ps
GHOSTVIEW = gv
DOCP = javadoc
ARCH = zip
PS2PDF = ps2pdf -dPDFX=true -sPAPERSIZE=a4
DATE = $(shell date +%Y-%m-%d)
# Exécution de commandes dans un nouveau terminal (changer en fct de l'OS)
TERM = xterm
# Options de compilation
#CFLAGS = -verbose
CFLAGS =
CLASSPATH=.
JAVAOPTIONS = --verbose
PROJECT=Chat_Client_Serveur
# nom du fichier d'impression
OUTPUT = $(PROJECT)
# nom du répertoire ou se situera la documentation
DOC = doc
# lien vers la doc en ligne du JDK
WEBLINK = "https://docs.oracle.com/javase/8/docs/api/"
# lien vers la doc locale du JDK
LOCALLINK = "file:///Users/davidroussel/Documents/docs/java/api/"
# nom de l'archive
ARCHIVE = $(PROJECT)
# format de l'archive pour la sauvegarde
ARCHFMT = zip
# Répertoire source
SRC = src
# Répertoire bin
BIN = bin
# Répertoire Listings
LISTDIR = listings
# Répertoire Archives
ARCHDIR = archives
# Répertoire Figures
FIGDIR = graphics
# noms des fichiers sources
MAIN = examples/RunRunnableExample \
examples/RunExampleFrame \
examples/RunListFrame \
RunChatServer \
RunChatClient
SOURCES = $(SRC)/AbstractRunChat.java \
$(SRC)/RunChatClient.java \
$(SRC)/RunChatServer.java \
$(SRC)/chat/client/ChatClient.java \
$(SRC)/chat/client/package-info.java \
$(SRC)/chat/client/ServerHandler.java \
$(SRC)/chat/client/UserHandler.java \
$(SRC)/chat/Failure.java \
$(SRC)/chat/package-info.java \
$(SRC)/chat/server/ChatServer.java \
$(SRC)/chat/server/ClientHandler.java \
$(SRC)/chat/server/InputClient.java \
$(SRC)/chat/server/InputOutputClient.java \
$(SRC)/chat/server/package-info.java \
$(SRC)/chat/UserOutputType.java \
$(SRC)/chat/Vocabulary.java \
$(SRC)/examples/package-info.java \
$(SRC)/examples/RunExampleFrame.java \
$(SRC)/examples/RunListFrame.java \
$(SRC)/examples/RunnableExample.java \
$(SRC)/examples/RunRunnableExample.java \
$(SRC)/examples/TestMessageStream.java \
$(SRC)/examples/widgets/ExampleFrame.java \
$(SRC)/examples/widgets/ListExampleFrame.java \
$(SRC)/logger/LoggerFactory.java \
$(SRC)/logger/package-info.java \
$(SRC)/models/Message.java \
$(SRC)/models/NameSetListModel.java \
$(SRC)/models/AuthorListFilter.java \
$(SRC)/models/package-info.java \
$(SRC)/widgets/AbstractClientFrame.java \
$(SRC)/widgets/ClientFrame.java \
$(SRC)/widgets/ClientFrame2.java \
$(SRC)/widgets/package-info.java \
$(foreach name, $(MAIN), $(SRC)/$(name).java)
OTHER = readme.txt \
reponses.txt \
Sujet.pdf \
MAJ.pdf \
$(SRC)/examples/icons/add_user-16.png \
$(SRC)/examples/icons/add_user-32.png \
$(SRC)/examples/icons/bg_blue-16.png \
$(SRC)/examples/icons/bg_blue-32.png \
$(SRC)/examples/icons/bg_color-32.png \
$(SRC)/examples/icons/bg_red-16.png \
$(SRC)/examples/icons/bg_red-32.png \
$(SRC)/examples/icons/delete_sign-16.png \
$(SRC)/examples/icons/delete_sign-32.png \
$(SRC)/examples/icons/erase-16.png \
$(SRC)/examples/icons/erase-32.png \
$(SRC)/examples/icons/remove_user-16.png \
$(SRC)/examples/icons/remove_user-32.png \
$(SRC)/icons/cancel-16.png \
$(SRC)/icons/cancel-32.png \
$(SRC)/icons/clock-16.png \
$(SRC)/icons/clock-32.png \
$(SRC)/icons/delete_database-16.png \
$(SRC)/icons/delete_database-32.png \
$(SRC)/icons/disconnected-16.png \
$(SRC)/icons/disconnected-32.png \
$(SRC)/icons/erase-16.png \
$(SRC)/icons/erase-32.png \
$(SRC)/icons/erase2-16.png \
$(SRC)/icons/erase2-32.png \
$(SRC)/icons/filled_filter-16.png \
$(SRC)/icons/filled_filter-32.png \
$(SRC)/icons/gender_neutral_user-16.png \
$(SRC)/icons/gender_neutral_user-32.png \
$(SRC)/icons/logout-16.png \
$(SRC)/icons/logout-32.png \
$(SRC)/icons/remove_user-16.png \
$(SRC)/icons/remove_user-32.png \
$(SRC)/icons/select_all-16.png \
$(SRC)/icons/select_all-32.png \
$(SRC)/icons/sent-16.png \
$(SRC)/icons/sent-32.png
.PHONY : doc ps
# Les targets de compilation
# pour générer l'application
all : $(foreach name, $(MAIN), $(BIN)/$(name).class)
#règle de compilation générique
$(BIN)/%.class : $(SRC)/%.java
$(JAVAC) -sourcepath $(SRC) -classpath $(BIN):$(CLASSPATH) -d $(BIN) $(CFLAGS) $<
# Edition des sources $(EDITOR) doit être une variable d'environnement
edit :
$(EDITOR) $(SOURCES) Makefile &
# nettoyer le répertoire
clean :
find bin/ -type f -name "*.class" -exec rm -f {} \;
rm -rf *~ *.log* $(DOC)/* $(LISTDIR)/*
#realclean : clean
# rm -f $(ARCHDIR)/*.$(ARCHFMT)
# générer le listing
$(LISTDIR) :
mkdir $(LISTDIR)
ps : $(LISTDIR)
$(A2PS) -2 --file-align=fill --line-numbers=1 --font-size=10 \
--chars-per-line=100 --tabsize=4 --pretty-print \
--highlight-level=heavy --prologue="gray" \
-o$(LISTDIR)/$(OUTPUT).ps Makefile $(SOURCES)
pdf : ps
$(PS2PDF) $(LISTDIR)/$(OUTPUT).ps $(LISTDIR)/$(OUTPUT).pdf
# générer le listing lisible pour Gérard
bigps :
$(A2PS) -1 --file-align=fill --line-numbers=1 --font-size=10 \
--chars-per-line=100 --tabsize=4 --pretty-print \
--highlight-level=heavy --prologue="gray" \
-o$(LISTDIR)/$(OUTPUT).ps Makefile $(SOURCES)
bigpdf : bigps
$(PS2PDF) $(LISTDIR)/$(OUTPUT).ps $(LISTDIR)/$(OUTPUT).pdf
# voir le listing
preview : ps
$(GHOSTVIEW) $(LISTDIR)/$(OUTPUT); rm -f $(LISTDIR)/$(OUTPUT) $(LISTDIR)/$(OUTPUT)~
# générer la doc avec javadoc
doc : $(SOURCES)
$(DOCP) -private -d $(DOC) -author -link $(LOCALLINK) $(SOURCES)
# $(DOCP) -private -d $(DOC) -author -linkoffline $(WEBLINK) $(LOCALLINK) $(SOURCES)
# générer une archive de sauvegarde
$(ARCHDIR) :
mkdir $(ARCHDIR)
archive : pdf $(ARCHDIR)
$(ARCH) $(ARCHDIR)/$(ARCHIVE).$(ARCHFMT) $(SOURCES) $(LISTDIR)/*.pdf \
$(FIGDIR)/*.pdf $(OTHER) $(BIN) Makefile $(FIGDIR)/*.pdf
# exécution des programmes de test
run : all
$(foreach name, $(MAIN), $(TERM) -e $(JAVA) -classpath $(BIN):$(CLASSPATH) $(name) $(JAVAOPTIONS) & )
# Lancement d'un serveur
runserver : all
$(TERM) -title server -e $(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatServer --noquit &
# Lancement d'un client console
runclient : all
$(TERM) -title "Zebulon" -e $(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --name Zébulon &
# Lancement d'un client graphique version 1
rungui1 : all
$(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --name Ténéphore --gui 1
# Lancement d'un client graphique version 2
rungui2 : all
$(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --verbose --name Zéphirine --gui 2
# Lancement d'un serveur, puis de 2 clients (l'un console, l'autre graphique)
rundemo : all
$(TERM) -title server -e $(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatServer & \
sleep 10;
$(TERM) -title "Zébulon" -e $(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --name Zebulon & \
$(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --name Ténéphore --gui 1 & \
$(JAVA) -classpath $(BIN):$(CLASSPATH) RunChatClient --name Anatole --gui 2;