Subversion Repositories HelenOS

Rev

Rev 4070 | Rev 4240 | 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 \
4061 svoboda 47
	genarch/gsp.c \
48
	genarch/stroke.c \
1339 cejka 49
	generic/key_buffer.c
50
 
3923 svoboda 51
ARCH_SOURCES =
52
GENARCH_SOURCES =
1339 cejka 53
 
4237 svoboda 54
ifeq ($(KBD_LAYOUT), cz)
55
	GENARCH_SOURCES += layout/cz.c
56
endif
3923 svoboda 57
ifeq ($(KBD_LAYOUT), us_qwerty)
58
	GENARCH_SOURCES += layout/us_qwerty.c
59
endif
60
ifeq ($(KBD_LAYOUT), us_dvorak)
61
	GENARCH_SOURCES += layout/us_dvorak.c
62
endif
63
 
64
ifeq ($(UARCH), amd64)
65
	GENARCH_SOURCES += \
66
		port/i8042.c \
67
		ctl/pc.c
68
endif
69
ifeq ($(UARCH), arm32)
70
	GENARCH_SOURCES += \
71
		port/gxemul.c
72
	ifeq ($(CONFIG_FB), y)
73
		GENARCH_SOURCES += \
74
			ctl/gxe_fb.c
75
	else
76
		GENARCH_SOURCES += \
77
			ctl/stty.c
78
	endif
79
endif
3882 decky 80
ifeq ($(UARCH), ia32)
3923 svoboda 81
	GENARCH_SOURCES += \
82
		port/i8042.c \
83
		ctl/pc.c
1707 palkovsky 84
endif
4067 jermar 85
ifeq ($(MACHINE), i460GX)
3923 svoboda 86
	GENARCH_SOURCES += \
3926 svoboda 87
		port/i8042.c \
88
		ctl/pc.c
3661 vana 89
endif
4044 svoboda 90
ifeq ($(MACHINE), ski)
91
	GENARCH_SOURCES += \
92
		port/ski.c \
93
		ctl/stty.c
94
endif
3923 svoboda 95
ifeq ($(MACHINE), msim)
96
	GENARCH_SOURCES += \
97
		port/msim.c \
98
		ctl/stty.c
1707 palkovsky 99
endif
3923 svoboda 100
ifeq ($(MACHINE), lgxemul)
101
	GENARCH_SOURCES += \
102
		port/gxemul.c
103
	ifeq ($(CONFIG_FB), y)
104
		GENARCH_SOURCES += \
105
			ctl/gxe_fb.c
106
	else
107
		GENARCH_SOURCES += \
108
			ctl/stty.c
109
	endif
1873 jermar 110
endif
3923 svoboda 111
ifeq ($(MACHINE), bgxemul)
112
	GENARCH_SOURCES += \
113
		port/gxemul.c \
114
		ctl/stty.c
2465 jermar 115
endif
3923 svoboda 116
ifeq ($(UARCH), ppc32)
3672 jermar 117
	GENARCH_SOURCES += \
3923 svoboda 118
		port/dummy.c \
119
		ctl/stty.c
3672 jermar 120
endif
3923 svoboda 121
ifeq ($(UARCH), sparc64)
4070 rimsky 122
    ifeq ($(MACHINE),serengeti)
3754 svoboda 123
	GENARCH_SOURCES += \
4070 rimsky 124
		port/sgcn.c \
125
		ctl/stty.c
126
    else
127
	GENARCH_SOURCES += \
3925 svoboda 128
		port/z8530.c \
3924 svoboda 129
		ctl/sun.c
4070 rimsky 130
    endif
3754 svoboda 131
endif
1707 palkovsky 132
 
1339 cejka 133
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
134
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
1873 jermar 135
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
1339 cejka 136
 
3699 svoboda 137
OBJECTS := $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(GENARCH_OBJECTS)
138
 
1339 cejka 139
.PHONY: all clean depend disasm links
140
 
4049 svoboda 141
all: $(OUTPUT) $(OUTPUT).disasm
1339 cejka 142
 
143
-include Makefile.depend
144
 
145
clean:
4049 svoboda 146
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS)
1339 cejka 147
 
148
depend:
149
	$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
150
 
3699 svoboda 151
$(OUTPUT): $(OBJECTS) $(LIBS)
3882 decky 152
	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
1339 cejka 153
 
3201 svoboda 154
disasm: $(OUTPUT).disasm
1339 cejka 155
 
3201 svoboda 156
$(OUTPUT).disasm: $(OUTPUT)
157
	$(OBJDUMP) -d $< >$@
158
 
1339 cejka 159
%.o: %.S
160
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
161
 
162
%.o: %.s
163
	$(AS) $(AFLAGS) $< -o $@
164
 
165
%.o: %.c
166
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@