Tutorials Multimedia in the Net

Winter Semester 2006/2007

Pointers, Makefiles

Raphael Wimmer <raphael.wimmer@medien.ifi.lmu.de>

To activate the slide show, click on the button in the upper right.
In Opera you can just switch to fullscreen mode with In Opera you can just switch to fullscreen mode with <F11>

What we will cover today

Pointers


(Source: http://www.cs.cf.ac.uk/Dave/C)

What are Makefiles?

Structure of a Makefile


Rule Syntax:

target [target...] : [prerequisite ....]
[ command ...]

Commands must be prepended by a <Tab>!

Example of a Makefile

CC=/usr/bin/sdcc
GLNK=$(TOOLSDIR)/bin/gplink
LIBM18F=/usr/share/sdcc/lib/pic16/libm18f.lib
DEBUG+=-D_BUILDTIME='\"Build:$(shell date +%Y%m%d_%H%M)\\n\"'

# default target
all: application.hex

application.hex: main.o init.o interrupts.o commands.o filter.o
$(GLNK) -w -s 18f2550.lkr -m $+ libsdcc.lib $(LIBM18F) -o $@

%.o: %.c
$(CC) -mpic16 $(DEBUG) -c $< -o $@

flash: application.hex
docker -v dead -p d00d write application.hex

clean:
-rm -f *.o *.rel *.lst *.cod *.hex *.map *.asm

.PHONY: all clean

Links

Makefiles

Pointers