-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (30 loc) · 722 Bytes
/
Makefile
File metadata and controls
42 lines (30 loc) · 722 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
CC := gcc
TARGET := nspirectl
SRC := main.c
OBJ := $(SRC:.c=.o)
DEP := $(OBJ:.o=.d)
BINDIR ?= /usr/local/bin
SANITIZE := -g -fsanitize=address -O0
CFLAGS := -MMD -Wall -Wextra -Ofast $(SANITIZE)
LDFLAGS := -lnspire $(SANITIZE)
# % = wildcard
# $@ = target
# $< = first prerequisite
# $^ = every prerequisite
all: $(TARGET)
$(TARGET): $(OBJ)
@echo "Linking objects -> target ($@)"
@$(CC) $(LDFLAGS) -o $@ $(OBJ)
%.o: %.c
@echo "Compiling $< -> $@"
@$(CC) $(CFLAGS) -c $< -o $@
install: $(TARGET)
@cp $(TARGET) $(BINDIR)
clean:
@echo "Removing dependency files (*.d)"
@rm -f $(DEP)
@echo "Removing object files (*.o)"
@rm -f $(OBJ)
@echo "Removing target ($(TARGET))"
@rm -f $(TARGET)
-include $(DEP)