Subversion Repositories HelenOS

Rev

Rev 4044 | Rev 4061 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1339 cejka 1
#
2071 jermar 2
# Copyright (c) 2005 Martin Decky
1339 cejka 3
# All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
#
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
13
#   documentation and/or other materials provided with the distribution.
14
# - The name of the author may not be used to endorse or promote products
15
#   derived from this software without specific prior written permission.
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
28
 
29
## Setup toolchain
30
#
31
 
2479 jermar 32
LIBC_PREFIX = ../../lib/libc
33
SOFTINT_PREFIX = ../../lib/softint
3882 decky 34
 
3803 decky 35
include $(LIBC_PREFIX)/Makefile.toolchain
1339 cejka 36
 
1352 palkovsky 37
CFLAGS += -Iinclude -I../libadt/include
1339 cejka 38
 
1352 palkovsky 39
LIBS = $(LIBC_PREFIX)/libc.a
1339 cejka 40
 
41
## Sources
42
#
43
 
44
OUTPUT = kbd
45
GENERIC_SOURCES = \
46
	generic/kbd.c \
47
	generic/key_buffer.c
48
 
3923 svoboda 49
ARCH_SOURCES =
50
GENARCH_SOURCES =
1339 cejka 51
 
3923 svoboda 52
ifeq ($(KBD_LAYOUT), us_qwerty)
53
	GENARCH_SOURCES += layout/us_qwerty.c
54
endif
55
ifeq ($(KBD_LAYOUT), us_dvorak)
56
	GENARCH_SOURCES += layout/us_dvorak.c
57
endif
58
 
59
ifeq ($(UARCH), amd64)
60
	GENARCH_SOURCES += \
61
		port/i8042.c \
62
		ctl/pc.c
63
endif
64
ifeq ($(UARCH), arm32)
65
	GENARCH_SOURCES += \
66
		port/gxemul.c
67
	ifeq ($(CONFIG_FB), y)
68
		GENARCH_SOURCES += \
69
			ctl/gxe_fb.c
70
	else
71
		GENARCH_SOURCES += \
72
			ctl/stty.c
73
	endif
74
endif
3882 decky 75
ifeq ($(UARCH), ia32)
3923 svoboda 76
	GENARCH_SOURCES += \
77
		port/i8042.c \
78
		ctl/pc.c
1707 palkovsky 79
endif
4044 svoboda 80
ifeq ($(MACHINE), i640GX)
3923 svoboda 81
	GENARCH_SOURCES += \
3926 svoboda 82
		port/i8042.c \
83
		ctl/pc.c
3661 vana 84
endif
4044 svoboda 85
ifeq ($(MACHINE), ski)
86
	GENARCH_SOURCES += \
87
		port/ski.c \
88
		ctl/stty.c
89
endif
3923 svoboda 90
ifeq ($(MACHINE), msim)
91
	GENARCH_SOURCES += \
92
		port/msim.c \
93
		ctl/stty.c
1707 palkovsky 94
endif
3923 svoboda 95
ifeq ($(MACHINE), lgxemul)
96
	GENARCH_SOURCES += \
97
		port/gxemul.c
98
	ifeq ($(CONFIG_FB), y)
99
		GENARCH_SOURCES += \
100
			ctl/gxe_fb.c
101
	else
102
		GENARCH_SOURCES += \
103
			ctl/stty.c
104
	endif
1873 jermar 105
endif
3923 svoboda 106
ifeq ($(MACHINE), bgxemul)
107
	GENARCH_SOURCES += \
108
		port/gxemul.c \
109
		ctl/stty.c
2465 jermar 110
endif
3923 svoboda 111
ifeq ($(UARCH), ppc32)
3672 jermar 112
	GENARCH_SOURCES += \
3923 svoboda 113
		port/dummy.c \
114
		ctl/stty.c
3672 jermar 115
endif
3923 svoboda 116
ifeq ($(UARCH), sparc64)
3754 svoboda 117
	GENARCH_SOURCES += \
3925 svoboda 118
		port/z8530.c \
3924 svoboda 119
		ctl/sun.c
3754 svoboda 120
endif
1707 palkovsky 121
 
1339 cejka 122
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
123
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
1873 jermar 124
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
1339 cejka 125
 
3699 svoboda 126
OBJECTS := $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(GENARCH_OBJECTS)
127
 
1339 cejka 128
.PHONY: all clean depend disasm links
129
 
4049 svoboda 130
all: $(OUTPUT) $(OUTPUT).disasm
1339 cejka 131
 
132
-include Makefile.depend
133
 
134
clean:
4049 svoboda 135
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS)
1339 cejka 136
 
137
depend:
138
	$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
139
 
3699 svoboda 140
$(OUTPUT): $(OBJECTS) $(LIBS)
3882 decky 141
	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
1339 cejka 142
 
3201 svoboda 143
disasm: $(OUTPUT).disasm
1339 cejka 144
 
3201 svoboda 145
$(OUTPUT).disasm: $(OUTPUT)
146
	$(OBJDUMP) -d $< >$@
147
 
1339 cejka 148
%.o: %.S
149
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
150
 
151
%.o: %.s
152
	$(AS) $(AFLAGS) $< -o $@
153
 
154
%.o: %.c
155
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@