author | mjsousa <msousa@fe.up.pt> |
Sun, 06 Jun 2021 22:40:06 +0100 | |
changeset 15 | cadd89d14ca5 |
parent 2 | 19bf8e678c42 |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
default: all |
|
3 |
||
4 |
all: libmb.a libmb.so |
|
5 |
||
6 |
OBJ_FILES = mb_ascii.o mb_rtu.o mb_tcp.o mb_master.o mb_slave.o mb_slave_and_master.o sin_util.o |
|
7 |
||
8 |
libmb.a: $(OBJ_FILES) |
|
2
19bf8e678c42
Let Makefile use default CFLAGS and CC instead of overriding them
Edouard Tisserant
parents:
0
diff
changeset
|
9 |
$(AR) cr libmb.a $(OBJ_FILES) |
0 | 10 |
|
11 |
libmb.so: $(OBJ_FILES) |
|
2
19bf8e678c42
Let Makefile use default CFLAGS and CC instead of overriding them
Edouard Tisserant
parents:
0
diff
changeset
|
12 |
$(CC) -shared -fPIC -o libmb.so $(OBJ_FILES) |
0 | 13 |
|
14 |
clean: |
|
15 |
-rm -rf *.o libmb.a libmb.so |
|
16 |
||
17 |
||
18 |
||
19 |
# use gcc |
|
2
19bf8e678c42
Let Makefile use default CFLAGS and CC instead of overriding them
Edouard Tisserant
parents:
0
diff
changeset
|
20 |
# CC = gcc |
0 | 21 |
|
22 |
#get warnings, debugging information and optimization |
|
2
19bf8e678c42
Let Makefile use default CFLAGS and CC instead of overriding them
Edouard Tisserant
parents:
0
diff
changeset
|
23 |
# CFLAGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wwrite-strings |
0 | 24 |
# CFLAGS += -Werror |
2
19bf8e678c42
Let Makefile use default CFLAGS and CC instead of overriding them
Edouard Tisserant
parents:
0
diff
changeset
|
25 |
# CFLAGS += -ggdb -O3 -funroll-loops |
0 | 26 |
# Note: if the optimizer crashes, we'll leave out the -O3 for those files |
27 |
||
28 |
# Required for compilation with beremiz, and to create shared object library |
|
29 |
CFLAGS += -fPIC |
|
30 |
||
31 |
||
32 |
||
33 |
#how to make things from other directories if they are missing |
|
34 |
../% /%: |
|
35 |
$(MAKE) -C $(@D) $(@F) |
|
36 |
||
37 |
Makefile.depend depend: |
|
38 |
# gcc -MM -MG -I$(LLIB) *.c \ |
|
39 |
gcc -MM -MG *.c \ |
|
40 |
| perl -pe 's/:/ Makefile.depend:/' \ |
|
41 |
> Makefile.depend |
|
42 |
||
43 |
include Makefile.depend |
|
44 |