changes on building (clean-up) and emulation code

cleaned up Makefile a bit and made emulation related
parts really conditional on a single flag (EMULATE_READER).
pull/2/merge
HW 13 years ago
parent 8fa7bdb9e9
commit f78776a4d5

@ -4,42 +4,41 @@ LUADIR=lua
MUPDFDIR=mupdf MUPDFDIR=mupdf
MUPDFTARGET=build/debug MUPDFTARGET=build/debug
MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET) MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET)
LDFLAGS=-lm -ldl
# set this to your ARM cross compiler: # set this to your ARM cross compiler:
CC:=arm-unknown-linux-gnueabi-gcc CC:=arm-unknown-linux-gnueabi-gcc
#CC:=gcc HOSTCC:=gcc
#ALLCFLAGS:=-g -O0 CFLAGS:=-O2
ALLCFLAGS:=-O2
# you can configure an emulation for the (eink) framebuffer here. # you can configure an emulation for the (eink) framebuffer here.
# the application won't use the framebuffer (and the special e-ink ioctls) # the application won't use the framebuffer (and the special e-ink ioctls)
# in that case. # in that case.
EMULATE_EINKFB_FILE=/tmp/displayfifo ifdef EMULATE_READER
#EMULATE_EINKFB_FILE=/dev/null CC:=$(HOSTCC)
EMULATE_EINKFB_W=824 EMULATE_READER_W?=824
EMULATE_EINKFB_H=1200 EMULATE_READER_H?=1200
EMU_CFLAGS?=$(shell sdl-config --cflags)
CFLAGS= $(ALLCFLAGS) -I$(LUADIR)/src -I$(MUPDFDIR)/ \ EMU_CFLAGS+= -DEMULATE_READER \
-DEMULATE_EINKFB_FILE='"$(EMULATE_EINKFB_FILE)"' \ -DEMULATE_READER_W=$(EMULATE_READER_W) \
-DEMULATE_EINKFB_W=$(EMULATE_EINKFB_W) \ -DEMULATE_READER_H=$(EMULATE_READER_H) \
-DEMULATE_EINKFB_H=$(EMULATE_EINKFB_H)
EMU_LDFLAGS?=$(shell sdl-config --libs)
# comment in the following line if you want to use the framebuffer emulation: endif
#CFLAGS+= -DEMULATE_EINKFB # standard includes
KPDFREADER_CFLAGS=$(CFLAGS) -I$(LUADIR)/src -I$(MUPDFDIR)/
# enable tracing output: # enable tracing output:
#CFLAGS+= -DMUPDF_TRACE #KPDFREADER_CFLAGS+= -DMUPDF_TRACE
# for now, all dependencies except for the libc are compiled into the final binary: # for now, all dependencies except for the libc are compiled into the final binary:
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o
$(CC) $(LDFLAGS) \ $(CC) -lm -ldl $(EMU_LDFLAGS) \
kpdfview.o \ kpdfview.o \
einkfb.o \ einkfb.o \
pdf.o \ pdf.o \
@ -55,6 +54,13 @@ kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o input.o util.o
$(MUPDFLIBDIR)/libz.a \ $(MUPDFLIBDIR)/libz.a \
$(LUADIR)/src/liblua.a -o kpdfview $(LUADIR)/src/liblua.a -o kpdfview
einkfb.o input.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $(EMU_CFLAGS) $< -o $@
kpdfview.o pdf.o blitbuffer.o util.o: %.o: %.c
$(CC) -c $(KPDFREADER_CFLAGS) $< -o $@
fetchthirdparty: fetchthirdparty:
-rmdir mupdf -rmdir mupdf
-rmdir lua -rmdir lua
@ -71,31 +77,20 @@ cleanthirdparty:
make -C mupdf clean make -C mupdf clean
$(MUPDFDIR)/fontdump.host: $(MUPDFDIR)/fontdump.host:
make -C mupdf CC=gcc $(MUPDFTARGET)/fontdump make -C mupdf CC="$(HOSTCC)" $(MUPDFTARGET)/fontdump
cp -a $(MUPDFLIBDIR)/fontdump $(MUPDFDIR)/fontdump.host cp -a $(MUPDFLIBDIR)/fontdump $(MUPDFDIR)/fontdump.host
make -C mupdf clean make -C mupdf clean
$(MUPDFDIR)/cmapdump.host: $(MUPDFDIR)/cmapdump.host:
make -C mupdf CC=gcc $(MUPDFTARGET)/cmapdump make -C mupdf CC="$(HOSTCC)" $(MUPDFTARGET)/cmapdump
cp -a $(MUPDFLIBDIR)/cmapdump $(MUPDFDIR)/cmapdump.host cp -a $(MUPDFLIBDIR)/cmapdump $(MUPDFDIR)/cmapdump.host
make -C mupdf clean make -C mupdf clean
thirdparty: $(MUPDFDIR)/cmapdump.host $(MUPDFDIR)/fontdump.host thirdparty: $(MUPDFDIR)/cmapdump.host $(MUPDFDIR)/fontdump.host
make -C lua/src CC="$(CC)" CFLAGS="$(ALLCFLAGS)" MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E" liblua.a
# generate cmapdump and fontdump helpers.
# those need to be run on the build platform, not the target device.
# thus, we override the CC here.
make -C mupdf clean
# build only thirdparty libs, libfitz and pdf utils, which will care for libmupdf.a being built # build only thirdparty libs, libfitz and pdf utils, which will care for libmupdf.a being built
CC="$(CC)" CFLAGS="$(ALLCFLAGS)" make -C mupdf CMAPDUMP=cmapdump.host FONTDUMP=fontdump.host MUPDF= XPS_APPS= CFLAGS="$(CFLAGS)" make -C mupdf CC="$(CC)" CMAPDUMP=cmapdump.host FONTDUMP=fontdump.host MUPDF= XPS_APPS=
make -C lua/src CC="$(CC)" CFLAGS="$(CFLAGS)" MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E" liblua.a
install: install:
# install to kindle using USB networking # install to kindle using USB networking
scp kpdfview reader.lua alt_getopt.lua root@192.168.2.2:/mnt/us/test/ scp kpdfview reader.lua alt_getopt.lua root@192.168.2.2:/mnt/us/test/
display:
# run mplayer on a FIFO, fed by using the framebuffer emulation
# make a FIFO
[ -p $(EMULATE_EINKFB_FILE) ] || mknod $(EMULATE_EINKFB_FILE) p
# ...and display from it
mplayer -rawvideo format=y8:w=$(EMULATE_EINKFB_W):h=$(EMULATE_EINKFB_H) -demuxer rawvideo $(EMULATE_EINKFB_FILE)

Loading…
Cancel
Save