blob: c1216c2c58d16481fa4a90524429404694e83389 (
plain)
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
|
# These might need configuring:
GPUTILSBASE=/usr/share/gputils
ifndef PROCESSOR
PROCESSOR=16f628
endif
PWD=$(CURDIR)
BASEDIR=$(PWD)
SDCCBASE=$(PWD)/sdcc
BUILDDIR=$(PWD)/build/$(PROCESSOR)
BASEBUILDDIR=$(BUILDDIR)
SUBDIRS=share devices tools
ifdef DEVICES
SUBDIRS=share devices
endif
export
.PHONY: $(SUBDIRS) sim
SDCC=$(SDCCBASE)/bin/sdcc
all: procheader $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
clean:
rm -rf build *~
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
distclean: clean
rm -rf sdcc sdcc-build
sdcc: $(SDCCBASE)/share/sdcc/include/pic $(SDCCBASE)/inc2h.pl
# Build header files for required processor if necessary
procheader: sdcc $(SDCCBASE)/share/sdcc/include/pic/pic$(PROCESSOR).h
$(SDCCBASE)/share/sdcc/include/pic/pic$(PROCESSOR).h:
$(SDCCBASE)/inc2h.pl $(PROCESSOR) $(GPUTILSBASE) > \
$(SDCCBASE)/share/sdcc/include/pic/pic$(PROCESSOR).h
# Build sdcc (and extra pic include directory)
$(SDCCBASE)/share/sdcc/include/pic:
if [ ! -d sdcc-build ]; then mkdir sdcc-build; fi
cd sdcc-build && \
CVSROOT=:pserver:anonymous@sdcc.cvs.sourceforge.net:/cvsroot/sdcc cvs co -D 20051210 sdcc && \
perl -pi.bak -e 's/cl_console:://' sdcc/sim/ucsim/cmd.src/newcmdcl.h && \
cd sdcc && \
./configure --prefix=$(SDCCBASE) && \
make clean && \
make && \
make install && \
mkdir $(SDCCBASE)/share/sdcc/include/pic
# Using subversion to get SDCC - Adrian
# cd sdcc-build && \
# svn -r 2005 co https://svn.sourceforge.net/svnroot/sdcc/trunk/sdcc sdcc && \
# cd sdcc && \
# ./configure --prefix=$(SDCCBASE) && \
# make clean && \
# make && \
# make install && \
# mkdir $(SDCCBASE)/share/sdcc/include/pic
# Install tool for creating header files
$(SDCCBASE)/inc2h.pl:
cp sdcc-build/sdcc/support/scripts/inc2h.pl $(SDCCBASE)
sim:
cd build/16f628/stepmotor && gpsim -p16f628 stepmotor.hex \
-s stepmotor.cod
|