Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CC = gcc
target= reprap
firm_src = ${wildcard atmega*.c}
firmware = ${firm_src:.c=.hex}
PLATFORM = ${shell uname | tr '[A-Z]' '[a-z]'}

SIMAVR_R = shared/simavr
LIBC3 = shared/libc3
Expand Down Expand Up @@ -52,9 +53,13 @@ CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
LDFLAGS = ${shell pkg-config --libs IL 2>/dev/null}
LDFLAGS += -lpthread -lutil -ldl
LDFLAGS += -lm
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}
ifeq (${PLATFORM}, darwin)
LDFLAGS += -Wl,-rpath $(LIBC3)/${OBJ}/ -L$(LIBC3)/${OBJ}/ -lc3 -lc3gl
else
LDFLAGS += -Wl,-rpath $(LIBC3)/${OBJ}/.libs -L$(LIBC3)/${OBJ}/.libs -lc3 -lc3gl
endif

include ${SIMAVR_R}/examples/Makefile.opengl

Expand All @@ -76,8 +81,15 @@ ${board} : ${OBJ}/${target}_gl.o

build-simavr:
$(MAKE) -C $(SIMAVR_R) CC="$(CC)" CFLAGS="$(CFLAGS)" build-simavr
ifeq (${PLATFORM}, darwin)
build-libc3:
$(MAKE) -C $(LIBC3) CC="$(CC)" CFLAGS="$(CFLAGS)"
cp ${LIBC3}/${OBJ}/libc3.dylib ${OBJ}
cp ${LIBC3}/${OBJ}/libc3gl.dylib ${OBJ}
else
build-libc3:
$(MAKE) -C $(LIBC3) CC="$(CC)" CFLAGS="$(CFLAGS)"
endif
build-ftgl:
$(MAKE) -C $(FTGL) CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" lib
Expand Down
18 changes: 17 additions & 1 deletion shared/libc3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ DESTDIR = /usr/local

-include ${wildcard .make.options*}

ifeq (${PLATFORM}, darwin)
all: ${OBJ} src/$(CONFIG_H) ${OBJ}/libc3.dylib ${OBJ}/libc3gl.dylib
else
all: ${OBJ} src/$(CONFIG_H) ${OBJ}/libc3.la ${OBJ}/libc3gl.la
endif

${OBJ}:
mkdir -p ${OBJ}
Expand All @@ -66,6 +70,18 @@ src/$(CONFIG_H): Makefile
printf "#endif\n"; \
) >$@

${OBJ}/libc3.dylib: ${C3OBJ}
@echo LINK $@
$(E)$(CC) -dynamiclib -undefined suppress \
-compatibility_version 1.0.0 -current_version 1.0.0 \
-flat_namespace ${C3OBJ:.lo=.o} -o $@ $(LDFLAGS)

${OBJ}/libc3gl.dylib: ${C3GLOBJ}
@echo LINK $@
$(E)$(CC) -dynamiclib -undefined suppress \
-compatibility_version 1.0.0 -current_version 1.0.0 \
-flat_namespace ${C3GLOBJ:.lo=.o} -o $@ $(LDFLAGS)

${OBJ}/libc3.la: ${C3OBJ}
@echo LINK $@
$(E)$(LIBTOOL) --mode=link --tag=CC \
Expand Down Expand Up @@ -106,4 +122,4 @@ clean:

# include the dependency files generated by gcc, if any
-include ${wildcard ${OBJ}/*.d}