Subversion Repositories HelenOS

Rev

Rev 2935 | Rev 2938 | Go to most recent revision | 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
35
include $(LIBC_PREFIX)/Makefile.toolchain
2923 svoboda 36
include arch/$(ARCH)/Makefile.inc
2911 svoboda 37
 
38
CFLAGS += -I../../srv/kbd/include
39
 
40
LIBS = $(LIBC_PREFIX)/libc.a
41
 
42
## Sources
43
#
44
 
45
OUTPUT = debug
2923 svoboda 46
GENERIC_SOURCES = cmd.c \
2935 svoboda 47
	fib_synch.c \
2936 svoboda 48
	cons.c \
2911 svoboda 49
	main.c
50
 
2923 svoboda 51
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
52
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
2911 svoboda 53
 
2923 svoboda 54
.PHONY: all clean depend disasm inc
2911 svoboda 55
 
2923 svoboda 56
all: inc $(OUTPUT) disasm
2911 svoboda 57
 
2923 svoboda 58
inc:
59
	ln -sfn ../arch/$(ARCH)/include include/arch
60
 
2911 svoboda 61
-include Makefile.depend
62
 
63
clean:
2924 svoboda 64
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend include/arch
2935 svoboda 65
	find . -name '*.o' -follow -exec rm \{\} \;
2911 svoboda 66
 
67
depend:
2923 svoboda 68
	$(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend
2911 svoboda 69
 
2923 svoboda 70
$(OUTPUT): $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(LIBS)
71
	$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
2911 svoboda 72
 
73
disasm:
74
	$(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
75
 
76
%.o: %.S
77
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
78
 
79
%.o: %.s
80
	$(AS) $(AFLAGS) $< -o $@
81
 
82
%.o: %.c
83
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@