-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
47 lines (36 loc) · 1012 Bytes
/
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
TARGET:=connmap
SOURCES:=./sources
INCLUDES:=./includes
ifeq ($(MAKECMDGOALS),build)
BUILD:=./build
else ifeq ($(MAKECMDGOALS),debug)
BUILD:=./build/debug
else
BUILD:=./build
endif
CC:=gcc
CFLAGS:=-std=gnu11 -I$(INCLUDES) $(shell pkg-config --libs --cflags cairo x11 xfixes) -lm
CFILES:=$(shell find $(SOURCES) -printf '%P ' -name '*.c')
OFILES:=$(patsubst %.c,$(BUILD)/%.o,$(CFILES))
.PHONY: install build debug clean mkdir
.DEFAULT_GOAL:=build
install: build
cd ./connmap/resources && unzip -n ipv4.csv.zip
cp -R ./connmap ~/.config/
mkdir -p ~/.local/bin
cp connmap.elf ~/.local/bin/connmap
build: CFLAGS+=-O0
build: mkdir $(OFILES)
$(CC) $(OFILES) -o $(TARGET).elf $(CFLAGS)
debug: CFLAGS+=-O0 -ggdb -D DEBUG
debug: mkdir $(OFILES)
$(CC) $(OFILES) -o $(TARGET).debug.elf $(CFLAGS)
mkdir:
mkdir -p $(BUILD)
clean:
-rm -rf $(BUILD)
-rm -f $(TARGET).elf
-rm -f $(TARGET).debug.elf
-rm -f ./connmap/resources/ipv4.csv
$(OFILES): $(BUILD)/%.o: $(SOURCES)/%.c
$(CC) $(CFLAGS) -c $< -o $@