-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (57 loc) · 1.89 KB
/
Copy pathMakefile
File metadata and controls
69 lines (57 loc) · 1.89 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###############################################################
# Class:: CSC-615-01 Spring 2026
# Name:: Clement (Clément) Boillot
# Student ID:: 925043857
# Github-Name:: drawbu
# Project:: Term project - La voiture qui va vite
#
# File:: Makefile
#
###############################################################
CFLAGS := -std=gnu23 -W -Wall -Wextra -Wunused -Wpedantic
CFLAGS += -Wundef -Wshadow -Wcast-align
CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -Wcast-qual -Wno-pointer-to-int-cast
CFLAGS += -Wunreachable-code
CFLAGS += -iquote ./src
CFLAGS += -isystem ./lib
CFLAGS += -ffile-prefix-map=$(CURDIR)/=
CFLAGS += -MMD -MP
NAME := VegaMissile
SRC := $(shell find $(CURDIR)/src -name '*.c')
OBJ := $(SRC:.c=.o)
DEPS := $(OBJ:.o=.d)
LIBMOTORS := lib/motors/libmotors.a
LIBLINE := lib/line_sensors/libline.a
LIBUTILS := lib/utils/libutils.a
LIBRGB := lib/rgb_sensors/librgb.a
LIBLIDAR := lib/rp_lidar/liblidar.a
# Project libs must precede -lpigpio so static linking resolves.
LDLIBS := -L$(dir $(LIBMOTORS)) -lmotors
LDLIBS += -L$(dir $(LIBLINE)) -lline
LDLIBS += -L$(dir $(LIBUTILS)) -lutils
LDLIBS += -L$(dir $(LIBRGB)) -lrgb
LDLIBS += -L$(dir $(LIBLIDAR)) -llidar
LDLIBS += -lpigpio -lrt -lpthread -lm
.DEFAULT_GOAL := re
$(NAME): $(OBJ) $(LIBLIDAR) $(LIBUTILS) $(LIBRGB) $(LIBMOTORS) $(LIBLINE)
$(CC) -o $@ $(OBJ) $(LDLIBS)
.PHONY: debug
debug: DEBUG = 1
debug: CFLAGS += -DDEBUG_TARGET
debug: re
.PHONY: $(LIBMOTORS) $(LIBLINE) $(LIBUTILS) $(LIBRGB) $(LIBLIDAR)
$(LIBMOTORS) $(LIBLINE) $(LIBUTILS) $(LIBRGB) $(LIBLIDAR):
$(MAKE) -C $(@D) $(if $(filter 1,$(DEBUG)),DEBUG=1)
.PHONY: clean
clean:
$(RM) $(OBJ) $(DEPS) $(NAME)
$(MAKE) -C $(dir $(LIBLINE)) clean
$(MAKE) -C $(dir $(LIBMOTORS)) clean
$(MAKE) -C $(dir $(LIBUTILS)) clean
$(MAKE) -C $(dir $(LIBRGB)) clean
$(MAKE) -C $(dir $(LIBLIDAR)) clean
.PHONY: re
.NOTPARALLEL: re
re: clean $(NAME)
-include $(DEPS)