Subversion Repositories HelenOS

Rev

Rev 3108 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2911 svoboda 1
#
2
# Copyright (c) 2005 Martin Decky
2923 svoboda 3
# Copyright (c) 2008 Jiri Svoboda
2911 svoboda 4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
#
10
# - Redistributions of source code must retain the above copyright
11
#   notice, this list of conditions and the following disclaimer.
12
# - Redistributions in binary form must reproduce the above copyright
13
#   notice, this list of conditions and the following disclaimer in the
14
#   documentation and/or other materials provided with the distribution.
15
# - The name of the author may not be used to endorse or promote products
16
#   derived from this software without specific prior written permission.
17
#
18
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
#
29
 
30
## Setup toolchain
31
#
32
 
33
LIBC_PREFIX = ../../lib/libc
34
SOFTINT_PREFIX = ../../lib/softint
4377 svoboda 35
 
2911 svoboda 36
include $(LIBC_PREFIX)/Makefile.toolchain
4377 svoboda 37
include arch/$(UARCH)/Makefile.inc
3108 svoboda 38
include genarch/Makefile.inc
2911 svoboda 39
 
3108 svoboda 40
CFLAGS += -I../../srv/kbd/include -Igenarch/idec
2911 svoboda 41
 
42
LIBS = $(LIBC_PREFIX)/libc.a
43
 
44
## Sources
45
#
46
 
47
OUTPUT = debug
2923 svoboda 48
GENERIC_SOURCES = cmd.c \
2936 svoboda 49
	cons.c \
2938 svoboda 50
	dthread.c \
3005 svoboda 51
	breakpoint.c \
2911 svoboda 52
	main.c
53
 
3108 svoboda 54
SOURCES := $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES)
55
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
2911 svoboda 56
 
2923 svoboda 57
.PHONY: all clean depend disasm inc
2911 svoboda 58
 
2923 svoboda 59
all: inc $(OUTPUT) disasm
2911 svoboda 60
 
2923 svoboda 61
inc:
4377 svoboda 62
	ln -sfn ../arch/$(UARCH)/include include/arch
2923 svoboda 63
 
2911 svoboda 64
-include Makefile.depend
65
 
66
clean:
2924 svoboda 67
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend include/arch
2935 svoboda 68
	find . -name '*.o' -follow -exec rm \{\} \;
2911 svoboda 69
 
70
depend:
3108 svoboda 71
	$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
2911 svoboda 72
 
3108 svoboda 73
$(OUTPUT): $(OBJECTS) $(LIBS)
4377 svoboda 74
	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
2911 svoboda 75
 
76
disasm:
77
	$(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
78
 
79
%.o: %.S
80
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
81
 
82
%.o: %.s
83
	$(AS) $(AFLAGS) $< -o $@
84
 
85
%.o: %.c
86
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@