blob: 8e0c813d06feb0965f1b325ee755195a63f1eef4 (
plain)
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
70
71
72
73
74
75
76
77
|
# Standard housekeeping
.PHONY: all debug release clean target install
.SUFFIXES:
all: targets
debug: CC := clang
debug: CFLAGS += -DDEBUG -g -fsanitize=address
debug: INCS := -I $(INC_DIR)
debug: ELIBS := -fsanitize=address
debug: STATIC :=
debug: CINIT :=
debug: CFINI :=
debug: targets
release: CFLAGS += -O3 -mtune=native -flto -ffast-math #-DNDEBUG
release: targets
# Targets & array of sources & intermediates
SRCS :=
OBJS :=
DEPS :=
LIBS :=
BINS :=
UNTS :=
GENS :=
# Iterate through directory tree
DIR := sys
include $(DIR)/rules.mk
DIR := src
include $(DIR)/rules.mk
# Generic rules
%.a: %.o
$(ARCHIVE)
%: %.o
$(LINK)
$(OBJ_DIR)/%.o: %.c
$(COMPILE)
$(OBJ_DIR)/%.o: %.s
$(ASSEMBLE)
$(OBJ_DIR)/%: %.c
$(COMPLNK)
targets: $(LIBS) $(BINS) $(UNTS)
clean:
@echo removing object files
@rm -f $(OBJS)
@echo removing dependency files
@rm -f $(DEPS)
@echo removing generated source files
@rm -f $(GENS)
@echo removing libraries
@rm -f $(LIBS)
@echo removing binaries
@rm -f $(BINS)
@echo removing unit tests
@rm -f $(UNTS)
install: targets
@echo installing executables
@if [ -n $$BINS ]; then\
cp $(BINS) $(BIN_DIR); \
fi
@echo installing libraries
@if [ -n $$LIBS ]; then\
cp $(LIBS) $(LIB_DIR); \
fi
|