-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (33 loc) · 854 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (33 loc) · 854 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
TARGET:=sysm
SOURCES:=./sources
INCLUDES:=./headers
ifeq ($(MAKECMDGOALS),build)
BUILD:=./build
else ifeq ($(MAKECMDGOALS),debug)
BUILD:=./build/debug
else
BUILD:=./build
endif
CC:=g++
CFLAGS:=-std=c++20 -I$(INCLUDES) -lsfml-audio
CFILES:=$(shell find $(SOURCES) -printf '%P ' -name '*.cc')
OFILES:=$(patsubst %.cc,$(BUILD)/%.o,$(CFILES))
.PHONY: install build debug clean mkdir
.DEFAULT_GOAL:=build
install: build
cp -R ./sysm ~/.config/.
mkdir -p ~/.local/bin
cp sysm.elf ~/.local/bin/sysm
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
$(OFILES): $(BUILD)/%.o: $(SOURCES)/%.cc
$(CC) $(CFLAGS) -c $< -o $@