-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
executable file
·381 lines (298 loc) · 8.76 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#//MARK: -
#//MARK: Default action
default: show_usage
#//MARK: -
#//MARK: Declarations of object for each target
#//MARK: ----- Data structures
includes = \
bin/includes.o
data_structures_test = \
bin/list.o \
bin/graph.o \
bin/stack.o \
bin/tree.o \
bin/map.o \
bin/heap.o \
bin/queue.o \
bin/includes.o \
bin/data_structures_test.o
data_structures = \
bin/graph.o \
bin/list.o \
bin/stack.o \
bin/tree.o \
bin/map.o \
bin/heap.o \
bin/queue.o \
bin/includes.o
#//MARK: ----- TP1
tp1 = \
bin/sim_airline.o \
bin/sim_extra.o \
bin/sim_level.o \
bin/sim_plane.o \
bin/sim_client.o \
bin/sim_message.o \
bin/sim_server.o \
bin/sim_transporter.o \
bin/sim_msg_q_transporter.o \
bin/sim_pipe_transporter.o \
bin/sim_smem_transporter.o \
bin/sim_socket_transporter.o \
bin/sim_frontend.o \
bin/sim_validator.o \
bin/talloc.o
#//MARK: ----- TP1 Test
tp1_test_files = \
bin/sim_airline.o \
bin/sim_extra.o \
bin/sim_level.o \
bin/sim_plane.o \
bin/sim_client.o \
bin/sim_message.o \
bin/sim_server.o \
bin/sim_transporter.o \
bin/sim_msg_q_transporter.o \
bin/sim_pipe_transporter.o \
bin/sim_smem_transporter.o \
bin/sim_socket_transporter.o \
bin/tp1_test.o
#//MARK: ----- TP1 Test Child Process
tp1_test_child_files = \
bin/sim_airline.o \
bin/sim_extra.o \
bin/sim_level.o \
bin/sim_plane.o \
bin/sim_client.o \
bin/sim_message.o \
bin/sim_server.o \
bin/sim_transporter.o \
bin/sim_msg_q_transporter.o \
bin/sim_pipe_transporter.o \
bin/sim_smem_transporter.o \
bin/sim_socket_transporter.o \
bin/tp1_test_child.o
#//MARK: ----- TP1 Test Server Process
tp1_test_server_files = \
bin/sim_airline.o \
bin/sim_extra.o \
bin/sim_level.o \
bin/sim_plane.o \
bin/sim_client.o \
bin/sim_message.o \
bin/sim_server.o \
bin/sim_transporter.o \
bin/sim_msg_q_transporter.o \
bin/sim_pipe_transporter.o \
bin/sim_smem_transporter.o \
bin/sim_socket_transporter.o \
bin/tp1_test_server.o
#//MARK: ----- Examples declarations
example_1 = \
bin/ejemplo_1.o
#//MARK: ----- Utils declarations
utils_test_files = \
bin/cstring.o \
bin/sem.o \
bin/shm.o \
bin/unixColors.o \
bin/utils_test.o
utils = \
bin/unixColors.o \
bin/sem.o \
bin/shm.o \
bin/cstring.o
#//MARK: ----- GCC Declarations
### Flags and declarations
UNAME := $(shell uname -s)
ifeq ($(UNAME),Linux)
cc = gcc -m32 -g -lpthread -rdynamic
else
cc = gcc -m32 -g
endif
#//MARK: -
#//MARK: Object file compilations
#//MARK: ----- Data structures
#### Graph
data_structures_graph:
$(cc) -o bin/graph.o -c src/data_structures/graph.c
#### List
data_structures_list:
$(cc) -o bin/list.o -c src/data_structures/list.c
#### Stack
data_structures_stack:
$(cc) -o bin/stack.o -c src/data_structures/stack.c
#### Tree
data_structures_tree:
$(cc) -o bin/tree.o -c src/data_structures/tree.c
#### Map
data_structures_map:
$(cc) -o bin/map.o -c src/data_structures/map.c
#### Heap
data_structures_heap:
$(cc) -o bin/heap.o -c src/data_structures/heap.c
#### Heap
data_structures_queue:
$(cc) -o bin/queue.o -c src/data_structures/queue.c
#### Global Test File for Data Structures
data_structures_tests_data_structures_test:
$(cc) -o bin/data_structures_test.o \
-c src/data_structures/tests/data_structures_test.c
### End of data structures
#//MARK: ----- Utils
utils_cstring:
$(cc) -o bin/cstring.o -c src/utils/cstring.c
utils_sem:
$(cc) -o bin/sem.o -c src/utils/sem.c
utils_shm:
$(cc) -o bin/shm.o -c src/utils/shm.c
utils_test_build:
$(cc) -o bin/utils_test.o -c src/utils/utils_test.c
### End of Utils
### Includes
includes:
$(cc) -o bin/includes.o -c src/includes.c
### End of Includes
#//MARK: ----- TP1
sim_airline:
$(cc) -o bin/sim_airline.o -c src/tps/tp1/core/sim_airline.c
sim_extra:
$(cc) -o bin/sim_extra.o -c src/tps/tp1/core/sim_extra.c
sim_level:
$(cc) -o bin/sim_level.o -c src/tps/tp1/core/sim_level.c
sim_plane:
$(cc) -o bin/sim_plane.o -c src/tps/tp1/core/sim_plane.c
sim_client:
$(cc) -o bin/sim_client.o -c src/tps/tp1/networking/sim_client.c
sim_message:
$(cc) -o bin/sim_message.o -c src/tps/tp1/networking/sim_message.c
sim_server:
$(cc) -o bin/sim_server.o -c src/tps/tp1/networking/sim_server.c
sim_transporter:
$(cc) -o bin/sim_transporter.o -c src/tps/tp1/networking/sim_transporter.c
sim_msg_q_transporter:
$(cc) -o bin/sim_msg_q_transporter.o -c src/tps/tp1/networking/transporters/sim_msg_q_transporter.c
sim_pipe_transporter:
$(cc) -o bin/sim_pipe_transporter.o -c src/tps/tp1/networking/transporters/sim_pipe_transporter.c
sim_smem_transporter:
$(cc) -o bin/sim_smem_transporter.o -c src/tps/tp1/networking/transporters/sim_smem_transporter.c
sim_socket_transporter:
$(cc) -o bin/sim_socket_transporter.o -c src/tps/tp1/networking/transporters/sim_socket_transporter.c
sim_frontend:
$(cc) -o bin/sim_frontend.o -c src/tps/tp1/app/sim_frontend.c
sim_validator:
$(cc) -o bin/sim_validator.o -c src/tps/tp1/app/sim_validator.c
sim_tp1:
$(cc) -o bin/tp1.o -c src/tps/tp1/tp1.c
sim_tp1_airline:
$(cc) -o bin/tp1_airline.o -c src/tps/tp1/tp1_airline.c
sim_tp1_level:
$(cc) -o bin/tp1_level.o -c src/tps/tp1/tp1_level.c
sim_tp1_test:
$(cc) -o bin/tp1_test.o -c src/tps/tp1/tests/tp1_test.c
sim_tp1_test_child:
$(cc) -o bin/tp1_test_child.o -c src/tps/tp1/tests/tp1_test_child.c
sim_tp1_test_server:
$(cc) -o bin/tp1_test_server.o -c src/tps/tp1/tests/tp1_test_server.c
talloc:
$(cc) -o bin/talloc.o -c src/utils/talloc.c
colors:
$(cc) -o bin/colors.o -c src/utils/colors.c
noColors:
$(cc) -o bin/noColors.o -c src/utils/noColors.c
unixColors:
$(cc) -o bin/unixColors.o -c src/utils/unixColors.c
winColors:
$(cc) -o bin/winColors.o -c src/utils/winColors.c
#//MARK: ----- Targets
### All targets must move to bin
clear_data_structures_test:
rm bin/*.o;
rm data_structures_test;
clear_utils_test:
rm bin/*.o;
rm utils_test;
### Data structures tests
data_structures_test: data_structures_graph data_structures_list data_structures_heap \
data_structures_stack data_structures_tree data_structures_map includes \
data_structures_queue \
data_structures_tests_data_structures_test
$(cc) -o data_structures_test $(data_structures_test)
utils_test: utils_cstring utils_test_build utils_sem utils_shm data_structures_list unixColors
$(cc) -o utils_test $(utils_test_files) $(data_structures)
build_tp1: data_structures_graph \
data_structures_list \
data_structures_heap \
data_structures_stack \
data_structures_tree \
data_structures_queue \
data_structures_map includes \
sim_airline \
sim_extra \
sim_level \
sim_plane \
sim_client \
sim_message \
sim_server \
sim_transporter \
sim_msg_q_transporter \
sim_pipe_transporter \
sim_smem_transporter \
sim_socket_transporter \
sim_frontend \
sim_validator
### Generates tp1
tp1: build_tp1 \
sim_tp1 \
sim_tp1_level \
sim_tp1_airline \
utils_cstring utils_sem utils_shm unixColors talloc
$(cc) -o tp1 $(tp1) $(data_structures) $(utils) bin/tp1.o
$(cc) -o tp1_level $(tp1) $(data_structures) $(utils) bin/tp1_level.o
$(cc) -o tp1_airline $(tp1) $(data_structures) $(utils) bin/tp1_airline.o
tp1_test: build_tp1 \
sim_tp1_test \
sim_tp1_test_child \
sim_tp1_test_server \
utils_cstring utils_sem utils_shm unixColors talloc
$(cc) -o tp1_test_child $(tp1_test_child_files) $(data_structures) $(utils)
$(cc) -o tp1_test_server $(tp1_test_server_files) $(data_structures) $(utils)
$(cc) -o tp1_test $(tp1_test_files) $(data_structures) $(utils)
#//MARK: ----- Usage
# Usage print script
show_usage:
@echo "--------------------------------------------"
@echo "MAKEFILE USAGE DOCUMENTATION"
@echo "\nSISTEMAS OPERATIVOS - ITBA - 2011"
@echo "\nAlumnos:"
@echo "\tMARSEILLAN, AGUSTIN"
@echo "\tPEREYRA, CRISTIAN"
@echo "\tVIDELA, MAXIMO"
@echo "--------------------------------------------"
@echo "Usage: \"make {action}\"\n"
@echo "\taction:"
@echo "\t\tfinal binaries:"
@echo "\t\t\ttp{number}(_test)"
@echo "\t\t\texample{number}"
@echo "\t\ttests:"
@echo "\t\t\tdata_structures_test"
@echo "\t\t\tutils_test"
@echo "\t\tcleaning:"
@echo "\t\t\tclean_{target}"
@echo "--------------------------------------------"
@echo "Examples:"
@echo "\t\nCompiling a TP:\n"
@echo "\t\"make tp1\""
@echo "\t\tIt compiles the tp number 1"
@echo "\t\"make tp1_test\""
@echo "\t\tRuns the tests for the tp number 1"
@echo "\t\nCompiling an example:\n"
@echo "\t\"make example1\""
@echo "\t\tIt compiles the example number 1"
@echo "\t\"make clean_tp1_test\""
@echo "\t\tCleans the tests for the tp1"
@echo "\nNotes:"
@echo "Only TP1 is available for now"
@echo "Example 1: Threads"
@echo "Example 2: Fork/exec/wait"
@echo "--------------------------------------------"