Subversion Repositories HelenOS

Rev

Rev 3108 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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