-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 792 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (23 loc) · 792 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
CC = gcc
CFLAGS = -Wall -c `pkg-config --cflags sdl2` -Wall -O3
LDFLAGS = `pkg-config --libs sdl2` -lm -lpthread -O3
EXE = pixel
# configuration
PIXEL_WIDTH = 800
PIXEL_HEIGHT = 600
PORT = 1234
DEFINES = -DPIXEL_WIDTH=$(PIXEL_WIDTH) -DPIXEL_HEIGHT=$(PIXEL_HEIGHT) -DPORT=$(PORT)
IP = $(shell ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $$2}' | cut -f1 -d'/')
INFO = $(IP):$(PORT) $(PIXEL_WIDTH)x$(PIXEL_HEIGHT)
all: $(EXE)
$(EXE): main.o
$(CC) -o $@ main.o $(LDFLAGS)
main.o: main.c
$(CC) $(CFLAGS) $(DEFINES) $< -o $@
clean:
rm -rf *.o $(EXE)
run:
make
./pixel &
convert -size 320x20 xc:Transparent -pointsize 20 -fill black -draw "text 2,19 '$(INFO)'" -fill white -draw "text 0,17 '$(INFO)'" ip.png
watch -n 10 python client.py 127.0.0.1 $(PORT) ip.png > /dev/null