Prepare for SDCC 4.5.0 release.
[sdcc.git] / sdcc / device / non-free / lib / pic16 / libdev / mkmk.sh
blobe58823bc4e997170fa59c9fee6e7d15cb53972a8
1 #!/bin/sh
4 # Consider using running 'sh update.sh' in '..' instead to
5 # also update the automake conditionals ENABLE_xxx!
7 # Script to generate Makefile.am,
8 # execute in device/lib/pic16/libdev/ with no arguments.
10 # For this to work, sdcc from PATH must already use the latest
11 # pic16fdevices.txt including to-be-added devices!
13 # Written by Raphael Neider <tecodev AT users sourceforge net>
15 # Released under the terms of the GPL v2.
18 cat <<HERE
19 ## Makefile.am -- Process this file with automake to produce Makefile.in
20 ## This file has been automatically generated using $0.
22 lib_LIBRARIES =
24 HERE
26 for f in ./pic1*.c; do
27 p="${f##*/pic}";
28 p="${p%.c}";
29 arch="$p";
30 ARCH=$(echo "$arch" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ);
31 cat <<HERE
32 if ENABLE_${ARCH}
33 lib_LIBRARIES += libdev${arch}.a
34 endif ENABLE_${ARCH}
35 libdev${arch}_a_SOURCES = pic${arch}.c
36 HERE
39 sdcc -mpic16 -p${arch} --nostdinc -I../../../../include/pic16 -I../../../../include -I../../../include/pic16 -o pic${arch}.inc -E pic${arch}.c;
40 if grep '\bEEADRH\b' pic${arch}.inc >/dev/null 2>&1; then
41 # 16 bit EEPROM address space
42 for i in get put; do
43 for j in 1 2 3 4; do
44 echo "libdev${arch}_a_SOURCES += gptr/eeprom16_gptr${i}${j}_dispatch.S";
45 done;
46 done;
47 elif grep '\bEEADR\b' pic${arch}.inc >/dev/null 2>&1; then
48 # 8 bit EEPROM address space
49 for i in get put; do
50 for j in 1 2 3 4; do
51 echo "libdev${arch}_a_SOURCES += gptr/eeprom8_gptr${i}${j}_dispatch.S";
52 done;
53 done;
54 else
55 # No EEPROM
56 echo "libdev${arch}_a_SOURCES += gptr/dispatch.S";
57 fi;
59 if ! grep '\bSSPBUF\b' pic${arch}.inc >/dev/null 2>&1; then
60 echo "libdev${arch}_a_SOURCES += fake_sspbuf.c";
61 fi;
62 rm pic${arch}.inc;
64 echo "libdev${arch}_a_CFLAGS = -p${arch} \$(AM_CFLAGS)";
65 echo "";
66 done;
68 cat <<HERE
69 include \$(top_srcdir)/Makefile.common
71 HERE