-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
94 lines (78 loc) · 2.78 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# Copyright 2008, 2012 Michel Pollet <[email protected]>
#
# This file is part of simreprap.
#
# simavr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# simavr is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with simavr. If not, see <http://www.gnu.org/licenses/>.
CC = gcc
target= reprap
firm_src = ${wildcard atmega*.c}
firmware = ${firm_src:.c=.hex}
SIMAVR_R = shared/simavr
LIBC3 = shared/libc3
FTGL = shared/libfreetype-gl
IPATH = .
IPATH += src
IPATH += $(LIBC3)/src
IPATH += $(LIBC3)/srcgl
IPATH += ${SIMAVR_R}/include
IPATH += ${SIMAVR_R}/simavr/sim
IPATH += ${SIMAVR_R}/examples/parts
IPATH += ${SIMAVR_R}/examples/shared
IPATH += ${FTGL}
VPATH = src
VPATH += ${SIMAVR_R}/examples/parts
VPATH += ${SIMAVR_R}/examples/shared
# requires libfreetype6-dev
FTC = ${shell PATH="$(PATH):/usr/X11/bin" which freetype-config}
# for the Open Motion Controller board
CPPFLAGS := -DMOTHERBOARD=91
# libdevil-dev provides IL.pc
CPPFLAGS += ${shell pkg-config --cflags IL 2>/dev/null}
CPPFLAGS += ${shell $(FTC) --cflags}
CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
LDFLAGS = ${shell pkg-config --libs IL 2>/dev/null}
LDFLAGS += -Wl,-rpath $(LIBC3)/${OBJ}/.libs -L$(LIBC3)/${OBJ}/.libs -lc3 -lc3gl
LDFLAGS += -Wl,-rpath ${SIMAVR_R}/simavr/${OBJ} -L${SIMAVR_R}/simavr/${OBJ}
LDFLAGS += -L${FTGL}/${OBJ} -lfreetype-gl ${shell $(FTC) --libs}
LDFLAGS += -lpthread -lutil -ldl
LDFLAGS += -lm
include ${SIMAVR_R}/examples/Makefile.opengl
all: obj ${firmware} ${target}
include ${SIMAVR_R}/Makefile.common
board = ${OBJ}/${target}.elf
${board} : ${OBJ}/c3text.o
${board} : ${OBJ}/arduidiot_pins.o
${board} : ${OBJ}/button.o
${board} : ${OBJ}/uart_pty.o
${board} : ${OBJ}/thermistor.o
${board} : ${OBJ}/heatpot.o
${board} : ${OBJ}/stepper.o
${board} : ${OBJ}/${target}.o
${board} : ${OBJ}/${target}_gl.o
build-simavr:
$(MAKE) -C $(SIMAVR_R) CC="$(CC)" CFLAGS="$(CFLAGS)" build-simavr
build-libc3:
$(MAKE) -C $(LIBC3) CC="$(CC)" CFLAGS="$(CFLAGS)"
build-ftgl:
$(MAKE) -C $(FTGL) CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" lib
${target}: build-simavr build-libc3 build-ftgl ${board}
@echo $@ done
clean: clean-${OBJ}
rm -rf *.a *.axf ${target} *.vcd
$(MAKE) -C $(LIBC3) CC="$(CC)" CFLAGS="$(CFLAGS)" clean
$(MAKE) -C $(SIMAVR_R)/simavr CC="$(CC)" CFLAGS="$(CFLAGS)" clean
$(MAKE) -C $(FTGL) CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" clean