Index: apps/beeper/beep.h |
— | — | @@ -0,0 +1,39 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2011 TheSeven, user890104
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __BEEP_H__
|
| 26 | +#define __BEEP_H__
|
| 27 | +
|
| 28 | +#include "emcoreapp.h"
|
| 29 | +
|
| 30 | +/////TIMER/////
|
| 31 | +#define TDCON (*((uint32_t volatile*)(0x3C700060)))
|
| 32 | +#define TDCMD (*((uint32_t volatile*)(0x3C700064)))
|
| 33 | +#define TDDATA0 (*((uint32_t volatile*)(0x3C700068)))
|
| 34 | +#define TDDATA1 (*((uint32_t volatile*)(0x3C70006C)))
|
| 35 | +#define TDPRE (*((uint32_t volatile*)(0x3C700070)))
|
| 36 | +#define TDCNT (*((uint32_t volatile*)(0x3C700074)))
|
| 37 | +
|
| 38 | +void singlebeep(unsigned int cycles, unsigned int time);
|
| 39 | +
|
| 40 | +#endif
|
Index: apps/beeper/SOURCES |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +beep.c
|
| 3 | +main.c
|
Index: apps/beeper/ls.x |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +ENTRY(__emcore_entrypoint)
|
| 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| 4 | +OUTPUT_ARCH(arm)
|
| 5 | +
|
| 6 | +MEMORY
|
| 7 | +{
|
| 8 | + VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
|
| 9 | +}
|
| 10 | +
|
| 11 | +SECTIONS
|
| 12 | +{
|
| 13 | + .text :
|
| 14 | + {
|
| 15 | + __emcore_app_base = .;
|
| 16 | + KEEP(.emcoreentrypoint*)
|
| 17 | + *(.emcoreentrypoint*)
|
| 18 | + *(.text*)
|
| 19 | + *(.glue_7)
|
| 20 | + *(.glue_7t)
|
| 21 | + . = ALIGN(0x10);
|
| 22 | + } > VIRTUAL
|
| 23 | +
|
| 24 | + .data :
|
| 25 | + {
|
| 26 | + *(.rodata*)
|
| 27 | + . = ALIGN(0x4);
|
| 28 | + *(.data*)
|
| 29 | + . = ALIGN(0x10);
|
| 30 | + } > VIRTUAL
|
| 31 | +
|
| 32 | + .bss (NOLOAD) :
|
| 33 | + {
|
| 34 | + *(.bss*)
|
| 35 | + *(COMMON)
|
| 36 | + } > VIRTUAL
|
| 37 | +
|
| 38 | + /DISCARD/ :
|
| 39 | + {
|
| 40 | + *(.eh_frame)
|
| 41 | + }
|
| 42 | +
|
| 43 | +}
|
Index: apps/beeper/main.c |
— | — | @@ -0,0 +1,116 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2011 TheSeven, user890104
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#include "emcoreapp.h"
|
| 26 | +#include "beep.h"
|
| 27 | +
|
| 28 | +void playsong(void *buf, size_t size);
|
| 29 | +
|
| 30 | +static void main()
|
| 31 | +{
|
| 32 | + if (0x47324e49 != get_platform_id()) // IN2G
|
| 33 | + {
|
| 34 | + cputs(3, "Your device is not supported!\n");
|
| 35 | + return;
|
| 36 | + }
|
| 37 | +
|
| 38 | + size_t size;
|
| 39 | + int fd;
|
| 40 | + void *buf;
|
| 41 | + unsigned char play;
|
| 42 | +
|
| 43 | + play = 0;
|
| 44 | + fd = file_open("/song.dat", O_RDONLY);
|
| 45 | +
|
| 46 | + if (fd <= 0)
|
| 47 | + {
|
| 48 | + cputs(3, "Unable to open /song.dat!\n");
|
| 49 | + return;
|
| 50 | + }
|
| 51 | +
|
| 52 | + cputs(3, "File opened\n");
|
| 53 | + size = filesize(fd);
|
| 54 | +
|
| 55 | + if (size <= 0)
|
| 56 | + {
|
| 57 | + close(fd);
|
| 58 | + cputs(3, "Unable to get file size or file is empty!\n");
|
| 59 | + return;
|
| 60 | + }
|
| 61 | +
|
| 62 | + cprintf(3, "File size: %d bytes\n", size);
|
| 63 | +
|
| 64 | + if (0 != size % 8)
|
| 65 | + {
|
| 66 | + close(fd);
|
| 67 | + cputs(3, "Invalid file, unable to continue!\n");
|
| 68 | + return;
|
| 69 | + }
|
| 70 | +
|
| 71 | + buf = memalign(0x10, size);
|
| 72 | +
|
| 73 | + if (!buf)
|
| 74 | + {
|
| 75 | + close(fd);
|
| 76 | + cputs(3, "Memory allocation failed!\n");
|
| 77 | + return;
|
| 78 | + }
|
| 79 | +
|
| 80 | + if (size != read(fd, buf, size))
|
| 81 | + {
|
| 82 | + free(buf);
|
| 83 | + close(fd);
|
| 84 | + cputs(3, "Read error!\n");
|
| 85 | + return;
|
| 86 | + }
|
| 87 | +
|
| 88 | + cputs(3, "Read successful\n");
|
| 89 | + close(fd);
|
| 90 | + cputs(3, "File closed\n");
|
| 91 | + playsong(buf, size);
|
| 92 | + free(buf);
|
| 93 | +}
|
| 94 | +
|
| 95 | +void playsong(void *buf, size_t size) {
|
| 96 | + int i;
|
| 97 | + unsigned int cycles[size / 8], lengths[size / 8];
|
| 98 | +
|
| 99 | + for (i = 0; i < size / 8; ++i)
|
| 100 | + {
|
| 101 | + cycles[i] = *((unsigned int *)(buf) + i + i);
|
| 102 | + lengths[i] = *((unsigned int *)(buf) + i + i + 1);
|
| 103 | + }
|
| 104 | +
|
| 105 | + for (i = 0; i < size / 8; ++i)
|
| 106 | + {
|
| 107 | + if (0 == cycles[i])
|
| 108 | + {
|
| 109 | + sleep(lengths[i]);
|
| 110 | + continue;
|
| 111 | + }
|
| 112 | +
|
| 113 | + singlebeep(cycles[i], lengths[i]);
|
| 114 | + }
|
| 115 | +}
|
| 116 | +
|
| 117 | +EMCORE_APP_HEADER("Beeper", main, 127)
|
Index: apps/beeper/mario.txt |
— | — | @@ -0,0 +1,83 @@ |
| 2 | +# Super Mario theme song |
| 3 | +# still unfinished, notes found on Internet |
| 4 | +# col1 = note, col2 = octave, col3 = duration (1 / x) |
| 5 | +# t = tempo (bpm), p = pause |
| 6 | + |
| 7 | +t 216 |
| 8 | + |
| 9 | +e 5 8 |
| 10 | +e 5 8 |
| 11 | +p 0 8 |
| 12 | +e 5 8 |
| 13 | +p 0 8 |
| 14 | +c 5 8 |
| 15 | +e 5 8 |
| 16 | +p 0 8 |
| 17 | + |
| 18 | +g 5 4 |
| 19 | +p 0 4 |
| 20 | +g 4 4 |
| 21 | +p 0 4 |
| 22 | + |
| 23 | +c 5 4 |
| 24 | +p 0 8 |
| 25 | +g 4 4 |
| 26 | +p 0 8 |
| 27 | +e 4 4 |
| 28 | + |
| 29 | +p 0 8 |
| 30 | +a 4 8 |
| 31 | +p 0 8 |
| 32 | +b 4 8 |
| 33 | +p 0 8 |
| 34 | +a# 4 8 |
| 35 | +a 4 8 |
| 36 | +p 0 8 |
| 37 | + |
| 38 | +g 4 8 |
| 39 | +e 5 8 |
| 40 | +p 0 8 |
| 41 | +g 5 8 |
| 42 | +a 5 8 |
| 43 | +p 0 8 |
| 44 | +f 5 8 |
| 45 | +g 5 8 |
| 46 | + |
| 47 | +p 0 8 |
| 48 | +e 5 8 |
| 49 | +p 0 8 |
| 50 | +c 5 8 |
| 51 | +d 5 8 |
| 52 | +b 4 8 |
| 53 | +p 0 4 |
| 54 | + |
| 55 | +c 5 4 |
| 56 | +p 0 8 |
| 57 | +g 4 4 |
| 58 | +p 0 8 |
| 59 | +e 4 4 |
| 60 | + |
| 61 | +p 0 8 |
| 62 | +a 4 8 |
| 63 | +p 0 8 |
| 64 | +b 4 8 |
| 65 | +p 0 8 |
| 66 | +a# 4 8 |
| 67 | +a 4 8 |
| 68 | +p 0 8 |
| 69 | + |
| 70 | +g 4 8 |
| 71 | +e 5 8 |
| 72 | +p 0 8 |
| 73 | +g 5 8 |
| 74 | +a 5 8 |
| 75 | +p 0 8 |
| 76 | +f 5 8 |
| 77 | +g 5 8 |
| 78 | + |
| 79 | +p 0 8 |
| 80 | +e 5 8 |
| 81 | +p 0 8 |
| 82 | +c 5 8 |
| 83 | +d 5 8 |
| 84 | +b 4 8 |
\ No newline at end of file |
Index: apps/beeper/convert.php |
— | — | @@ -0,0 +1,126 @@ |
| 2 | +<?php |
| 3 | +// |
| 4 | +// |
| 5 | +// Copyright 2011 user890104 |
| 6 | +// |
| 7 | +// |
| 8 | +// This file is part of emCORE. |
| 9 | +// |
| 10 | +// emCORE is free software: you can redistribute it and/or |
| 11 | +// modify it under the terms of the GNU General Public License as |
| 12 | +// published by the Free Software Foundation, either version 2 of the |
| 13 | +// License, or (at your option) any later version. |
| 14 | +// |
| 15 | +// emCORE is distributed in the hope that it will be useful, |
| 16 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 18 | +// See the GNU General Public License for more details. |
| 19 | +// |
| 20 | +// You should have received a copy of the GNU General Public License along |
| 21 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>. |
| 22 | +// |
| 23 | +// |
| 24 | + |
| 25 | + |
| 26 | +if ( |
| 27 | + empty($_SERVER['argc']) || empty($_SERVER['argv']) || |
| 28 | + !is_int($_SERVER['argc']) || !is_array($_SERVER['argv']) || |
| 29 | + 3 !== $_SERVER['argc'] || 3 !== count($_SERVER['argv']) |
| 30 | +) |
| 31 | +{ |
| 32 | + echo 'usage: ', $_SERVER['argv'][0], ' <input> <output>', "\n"; |
| 33 | + exit; |
| 34 | +} |
| 35 | + |
| 36 | +$start_oct = 0; |
| 37 | +$end_oct = 9; |
| 38 | + |
| 39 | +$notes = array(); |
| 40 | + |
| 41 | +for ($oct = $start_oct; $oct < $end_oct; ++$oct) |
| 42 | +{ |
| 43 | + $notes[$oct] = array(); |
| 44 | + $notes[$oct][-1] = 0; |
| 45 | + |
| 46 | + for ($note = 0; $note < 12; ++$note) |
| 47 | + { |
| 48 | + $freq = pow(2, ($oct * 12 + $note - 45) / 12) * 440; |
| 49 | + |
| 50 | + $notes[$oct][$note] = $freq; |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +$note_names = array( |
| 55 | + 'X' => -2, |
| 56 | + 'P' => -1, |
| 57 | + 'C' => 0, |
| 58 | + 'C#' => 1, |
| 59 | + 'D' => 2, |
| 60 | + 'D#' => 3, |
| 61 | + 'E' => 4, |
| 62 | + 'F' => 5, |
| 63 | + 'F#' => 6, |
| 64 | + 'G' => 7, |
| 65 | + 'G#' => 8, |
| 66 | + 'A' => 9, |
| 67 | + 'A#' => 10, |
| 68 | + 'B' => 11, |
| 69 | +); |
| 70 | + |
| 71 | +// ---------------------- |
| 72 | + |
| 73 | +$beat_len = 0; |
| 74 | + |
| 75 | +$note_lengths = array( |
| 76 | + '1+1+1/4' => 9, |
| 77 | + '1+1' => 8, |
| 78 | + '1' => 4, |
| 79 | + '2.5' => 3, |
| 80 | + '2+1/4' => 2.5, |
| 81 | + '2' => 2, |
| 82 | + '4.5' => 1.5, |
| 83 | + '4+1/2' => 1.5, |
| 84 | + '4' => 1, |
| 85 | + '8' => .5, |
| 86 | + '8+1/2+1/4' => .3 + 5/4, |
| 87 | + '16' => .25, |
| 88 | + '32' => .125, |
| 89 | +); |
| 90 | + |
| 91 | +file_put_contents($_SERVER['argv'][2], ''); |
| 92 | + |
| 93 | +$file = file($_SERVER['argv'][1]); |
| 94 | +$file = array_map('trim', $file); |
| 95 | +$file = array_map('strtoupper', $file); |
| 96 | + |
| 97 | +foreach ($file as $line) |
| 98 | +{ |
| 99 | + if (strlen($line) < 1 || '#' === $line[0]) |
| 100 | + { |
| 101 | + continue; |
| 102 | + } |
| 103 | + elseif ('T' == $line[0]) |
| 104 | + { |
| 105 | + $beat_len = 60 / trim(substr($line, 1)); |
| 106 | + continue; |
| 107 | + } |
| 108 | + |
| 109 | + if (empty($beat_len)) |
| 110 | + { |
| 111 | + continue; |
| 112 | + } |
| 113 | + $line = preg_replace('/\s+/', ' ', $line); |
| 114 | + @list($note, $oct, $len) = explode(' ', $line); |
| 115 | + |
| 116 | + $note = $note_names[$note]; |
| 117 | + |
| 118 | + if (-2 === $note) |
| 119 | + { |
| 120 | + exit; |
| 121 | + } |
| 122 | + |
| 123 | + $len = $note_lengths[$len] * $beat_len; |
| 124 | + |
| 125 | + file_put_contents($_SERVER['argv'][2], pack('VV', round($notes[$oct][$note] ? 91225 / $notes[$oct][$note] : 0), round($len * 1000000)), FILE_APPEND); |
| 126 | +} |
| 127 | +?> |
Index: apps/beeper/version.h |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2010 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __VERSION_H__
|
| 26 | +#define __VERSION_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +#define VERSION "0.0.1pre"
|
| 30 | +#define VERSION_MAJOR 0
|
| 31 | +#define VERSION_MINOR 0
|
| 32 | +#define VERSION_PATCH 1
|
| 33 | +#define VERSION_SVN "$REVISION$"
|
| 34 | +#define VERSION_SVN_INT $REVISIONINT$
|
| 35 | +
|
| 36 | +
|
| 37 | +#endif
|
Index: apps/beeper/beep.c |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2011 TheSeven, user890104
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#include "emcoreapp.h"
|
| 26 | +#include "beep.h"
|
| 27 | +
|
| 28 | +void singlebeep(unsigned int cycles, unsigned int time)
|
| 29 | +{
|
| 30 | + /* configure timer for 100 kHz */
|
| 31 | + TDCMD = (1 << 1); /* TD_CLR */
|
| 32 | + TDPRE = 30 - 1; /* prescaler */
|
| 33 | + TDCON =
|
| 34 | + //(1 << 13) | /* TD_INT1_EN */
|
| 35 | + //(0 << 12) | /* TD_INT0_EN */
|
| 36 | + //(0 << 11) | /* TD_START */
|
| 37 | + (2 << 8) | /* TD_CS = PCLK / 16 */
|
| 38 | + (1 << 4); /* TD_MODE_SEL = PWM mode */
|
| 39 | + TDDATA0 = cycles; /* set interval period */
|
| 40 | + TDDATA1 = cycles << 1; /* set interval period */
|
| 41 | + TDCMD = (1 << 0); /* TD_EN */
|
| 42 | + sleep(time);
|
| 43 | + TDCMD = (1 << 1); /* TD_CLR */
|
| 44 | +}
|
Index: apps/beeper/Makefile |
— | — | @@ -0,0 +1,120 @@ |
| 2 | +NAME := beeper
|
| 3 | +STACKSIZE := 4096
|
| 4 | +COMPRESS := true
|
| 5 | +
|
| 6 | +EMCOREDIR ?= ../../emcore/trunk/
|
| 7 | +
|
| 8 | +ifeq ($(shell uname),WindowsNT)
|
| 9 | +CCACHE :=
|
| 10 | +else
|
| 11 | +CCACHE := $(shell which ccache)
|
| 12 | +endif
|
| 13 | +
|
| 14 | +CROSS ?= arm-elf-eabi-
|
| 15 | +CC := $(CCACHE) $(CROSS)gcc
|
| 16 | +AS := $(CROSS)as
|
| 17 | +LD := $(CROSS)ld
|
| 18 | +OBJCOPY := $(CROSS)objcopy
|
| 19 | +ELF2ECA := $(CROSS)elf2emcoreapp
|
| 20 | +
|
| 21 | +LIBINCLUDES :=
|
| 22 | +
|
| 23 | +CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
|
| 24 | +LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| 25 | +
|
| 26 | +preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 27 | +preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
|
| 28 | +
|
| 29 | +REVISION := $(shell svnversion .)
|
| 30 | +REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| 31 | +
|
| 32 | +HELPERS := build/__emcore_armhelpers.o
|
| 33 | +
|
| 34 | +SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
| 35 | +OBJ := $(SRC:%.c=build/%.o)
|
| 36 | +OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
| 37 | +
|
| 38 | +all: $(NAME)
|
| 39 | +
|
| 40 | +-include $(OBJ:%=%.dep)
|
| 41 | +
|
| 42 | +$(NAME): build/$(NAME).emcoreapp
|
| 43 | +
|
| 44 | +build/$(NAME).emcoreapp: build/$(NAME).elf
|
| 45 | + @echo [EMCAPP] $<
|
| 46 | +ifeq ($(COMPRESS),true)
|
| 47 | + @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| 48 | +else
|
| 49 | + @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| 50 | +endif
|
| 51 | +
|
| 52 | +build/$(NAME).elf: ls.x $(OBJ)
|
| 53 | + @echo [LD] $@
|
| 54 | + @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
| 55 | +
|
| 56 | +build/%.o: %.c build/version.h
|
| 57 | + @echo [CC] $<
|
| 58 | +ifeq ($(shell uname),WindowsNT)
|
| 59 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 60 | +else
|
| 61 | + @-mkdir -p $(dir $@)
|
| 62 | +endif
|
| 63 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 64 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 65 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 66 | +ifeq ($(shell uname),WindowsNT)
|
| 67 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 68 | +else
|
| 69 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 70 | +endif
|
| 71 | + @rm -f $@.dep.tmp
|
| 72 | +
|
| 73 | +build/%.o: %.S build/version.h
|
| 74 | + @echo [CC] $<
|
| 75 | +ifeq ($(shell uname),WindowsNT)
|
| 76 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 77 | +else
|
| 78 | + @-mkdir -p $(dir $@)
|
| 79 | +endif
|
| 80 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 81 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 82 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 83 | +ifeq ($(shell uname),WindowsNT)
|
| 84 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 85 | +else
|
| 86 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 87 | +endif
|
| 88 | + @rm -f $@.dep.tmp
|
| 89 | +
|
| 90 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| 91 | + @echo [CC] $<
|
| 92 | +ifeq ($(shell uname),WindowsNT)
|
| 93 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 94 | +else
|
| 95 | + @-mkdir -p $(dir $@)
|
| 96 | +endif
|
| 97 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 98 | +
|
| 99 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
| 100 | + @echo [CC] $<
|
| 101 | +ifeq ($(shell uname),WindowsNT)
|
| 102 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 103 | +else
|
| 104 | + @-mkdir -p $(dir $@)
|
| 105 | +endif
|
| 106 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 107 | +
|
| 108 | +build/version.h: version.h .svn/entries
|
| 109 | + @echo [PP] $<
|
| 110 | +ifeq ($(shell uname),WindowsNT)
|
| 111 | + @-if not exist build md build
|
| 112 | + @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 113 | +else
|
| 114 | + @-mkdir -p build
|
| 115 | + @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 116 | +endif
|
| 117 | +
|
| 118 | +clean:
|
| 119 | + @rm -rf build
|
| 120 | +
|
| 121 | +.PHONY: all clean $(NAME)
|