Difference between revisions of "Linux"
From uGFX Wiki
(Created page with "µGFX runs natively on any Linux system that runs the X server. Running µGFX on your computer can be used to simplify the process of developing your embedded GUI because you...") |
(→Makefile) |
||
Line 5: | Line 5: | ||
== Makefile == | == Makefile == | ||
The following Makefile can be used to compile an µGFX application on a Linux system. Modify the highlighted line(s). | The following Makefile can be used to compile an µGFX application on a Linux system. Modify the highlighted line(s). | ||
− | <syntaxhighlight lang=make line start="1" highlight=" | + | <syntaxhighlight lang=make line start="1" highlight="15"> |
# The name of the project / binary | # The name of the project / binary | ||
PROJECT = ugfx | PROJECT = ugfx |
Revision as of 15:03, 1 July 2014
µGFX runs natively on any Linux system that runs the X server. Running µGFX on your computer can be used to simplify the process of developing your embedded GUI because you don't have to flash the firmware every time to try it. Also, this way µGFX can be used as the native GUI system on low power Linux devices such as the Raspberry-Pi and other single board computers.
Note: The performance of the resulting program is very bad. This is because the X driver just uses setPixel() and doesn't take any advantage of area blitting or double buffering. The application will run A LOT faster on the actual microcontroller.
Makefile
The following Makefile can be used to compile an µGFX application on a Linux system. Modify the highlighted line(s).
# The name of the project / binary
PROJECT = ugfx
# List C source files here
SRC = $(GFXSRC) \
main.c
# List all user directories here
UINCDIR = $(GFXINC) \
# List all libraries
LIBS = -lX11 -pthread
# Include uGFX
GFXLIB = /home/tectu/projects/resources/ugfx
include $(GFXLIB)/gfx.mk
include $(GFXLIB)/boards/base/Linux/board.mk
###############################################################################
# Do not change anything below this line unless you know what you're doing #
###############################################################################
# Your toolchain
CC = gcc
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
OBJS = $(SRC:.c=.o)
CCFLAGS = -O2 -Wall -DGFX_USE_OS_LINUX=TRUE
LDFLAGS =
###############################################################################
# Actual Makefile rules #
###############################################################################
all: $(OBJS) $(PROJECT)
%.o : %.c
$(CC) -c $(CCFLAGS) -I . $(INCDIR) $< -o $@
$(PROJECT): $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
clean:
-rm -f $(OBJS)
-rm -f $(PROJECT)