-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
53 lines (41 loc) · 1.28 KB
/
Makefile
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
# Compiler definitions
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
SIZE = $(CROSS_COMPILE)size
INCLUDES ?=
LIBS ?=
PORT ?= pc
BINDIR ?= bin/$(PORT)
PORTDIR ?= ports/$(PORT)
OBJDIR ?= obj/$(PORT)
OBJECTS :=
SRCDIR ?= $(PWD)
.PHONY: setfuse all clean
-include local.mk
include $(PORTDIR)/Makefile
$(BINDIR)/synth: $(OBJECTS) $(OBJDIR)/poly.a
@[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
$(CC) -g -o $@ $(LDFLAGS) $(LIBS) $^
$(OBJDIR)/poly.a: $(OBJDIR)/adsr.o $(OBJDIR)/waveform.o $(OBJDIR)/mml.o $(OBJDIR)/sequencer.o
$(AR) rcs $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.c
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CC) -o $@ -c $(CPPFLAGS) $(INCLUDES) $(CFLAGS) $<
$(CC) -MM $(CPPFLAGS) $(INCLUDES) $< \
| sed -e '/^[^ ]\+:/ s:^:$(OBJDIR)/:g' > [email protected]
$(OBJDIR)/%.o: $(PORTDIR)/%.c
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CC) -o $@ -c $(CPPFLAGS) $(INCLUDES) $(CFLAGS) $<
$(CC) -MM $(CPPFLAGS) $(INCLUDES) $< \
| sed -e '/^[^ ]\+:/ s:^:$(OBJDIR)/:g' > [email protected]
$(SRCDIR)/sine.c: $(SRCDIR)/gensine.py
python $^ --amplitude 127 --num-samples-bits \
--num-samples 6 --data-type int8_t \
> $@
clean:
-rm -fr $(OBJDIR) $(BINDIR)
$(BINDIR)/%.ihex: $(BINDIR)/%
$(OBJCOPY) -j .text -j .data -O ihex $^ $@
-include $(OBJDIR)/*.dep