aboutsummaryrefslogtreecommitdiff
path: root/rules.mk
blob: ff12fdbaffb59d66df7ffe9779a693eac58483f9 (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
# Standard housekeeping
.PHONY: 	all debug release clean target install
.SUFFIXES:

all: targets

debug: CFLAGS += -DDEBUG
debug: targets

release: CFLAGS += -O3 -flto #-DNDEBUG 
release: targets

# Targets & array of sources & intermediates
SRCS :=
OBJS :=
DEPS :=

LIBS := 
BINS :=
TSTS :=

# Iterate through directory tree
DIR := sys
include $(DIR)/rules.mk

# Generic rules
%.a: %.o
	@echo AR 		$^
	@$(ARCHIVE)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
	@echo CC 		$^
	@$(COMPILE)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.s
	@echo AS 		$^
	@$(ASSEMBLE)

%: %.o
	@echo CC 		$^
	@$(LINK)

$(OBJ_DIR)/%: $(SRC_DIR)/%.c
	@echo CC 		$^
	@$(COMPLNK)

targets: $(LIBS) $(BINS) $(TSTS)

clean:
	rm -f $(OBJS)
	rm -f $(DEPS) 
	rm -f $(LIBS) 
	rm -f $(BINS)
	rm -f $(TSTS)

install: targets
	echo "TODO"