summaryrefslogtreecommitdiff
path: root/slaves/Makefile
blob: cf4d5f3350f3f65c5f96eaf861d07365e885e967 (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
PROJECT = slaves
MCU = ATTINY85


AS = avr-as
LD = avr-ld
RM      = rm -rf
MKDIR   = @mkdir -p $(@D)

# Custom/TI/build resource locations.
SRCS = $(wildcard src/*.s) \
	$(wildcard libs/*.s)
OBJ = obj/
OBJS = $(addprefix $(OBJ),$(notdir $(SRCS:.s=.o)))
LD_SCRIPT = ld/$(MCU).ld

# Flags.
AFLAGS = -mmcu=attiny85 --fatal-warnings # -ffunction-sections \
# -ffreestanding -fdata-sections -std=c2x -Wall -Wextra -Werror -DPART_${MCU} -c -

# Compiler/standard resource locations.
# More flags.
LDFLAGS = -T $(LD_SCRIPT) --gc-sections


# Targets.
all: bin/$(PROJECT).elf

$(OBJ)%.o: src/%.s
	$(MKDIR)
	$(AS) -o $@ $^ $(AFLAGS)

$(info $$PROJECT is [${PROJECT}])
bin/$(PROJECT).elf: $(OBJS)
	$(MKDIR)
	$(LD) -o $@ $^ $(LDFLAGS)

clean:
	-$(RM) obj
	-$(RM) bin

.PHONY: all clean