-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (40 loc) · 947 Bytes
/
Makefile
File metadata and controls
52 lines (40 loc) · 947 Bytes
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
# Makefile to build the project
# NOTE: This file must not be changed.
# Parameters
CC = gcc
CFLAGS = -Wall
BIN = bin/
CABLE = cable/
SRC = src/
TX_SERIAL_PORT = /dev/ttyS10
RX_SERIAL_PORT = /dev/ttyS11
BAUD_RATE = 9600
TX_FILE = penguin.gif
RX_FILE = penguin-received.gif
# Main
.PHONY: all
all: main cable
main: $(SRC)/*.c
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ -lm
.PHONY: run_tx
run_tx: main
./$(BIN)/main $(TX_SERIAL_PORT) $(BAUD_RATE) tx $(TX_FILE)
.PHONY: run_rx
run_rx: main
./$(BIN)/main $(RX_SERIAL_PORT) $(BAUD_RATE) rx $(RX_FILE)
.PHONY: check_files
check_files:
diff -s $(TX_FILE) $(RX_FILE) || exit 0
# Cable
cable: $(CABLE)/cable.c
$(CC) $(CFLAGS) -o $(BIN)/$@ $^
.PHONY: run_cable
run_cable: cable
@command -v socat >/dev/null 2>&1 || { echo "Error: Could not find socat. Install socat and try again."; exit 1; }
sudo ./$(BIN)/cable
# Clean
.PHONY: clean
clean:
rm -f $(BIN)/main
rm -f $(BIN)/cable
rm -f $(RX_FILE)