Subversion Repositories HelenOS

Rev

Rev 3882 | Rev 3924 | 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
3882 decky 80
ifeq ($(UARCH), ia64)
3923 svoboda 81
	GENARCH_SOURCES += \
82
		port/dummy.c \
83
		ctl/stty.c
3661 vana 84
endif
3923 svoboda 85
ifeq ($(MACHINE), msim)
86
	GENARCH_SOURCES += \
87
		port/msim.c \
88
		ctl/stty.c
1707 palkovsky 89
endif
3923 svoboda 90
ifeq ($(MACHINE), lgxemul)
91
	GENARCH_SOURCES += \
92
		port/gxemul.c
93
	ifeq ($(CONFIG_FB), y)
94
		GENARCH_SOURCES += \
95
			ctl/gxe_fb.c
96
	else
97
		GENARCH_SOURCES += \
98
			ctl/stty.c
99
	endif
1873 jermar 100
endif
3923 svoboda 101
ifeq ($(MACHINE), bgxemul)
102
	GENARCH_SOURCES += \
103
		port/gxemul.c \
104
		ctl/stty.c
2465 jermar 105
endif
3923 svoboda 106
ifeq ($(UARCH), ppc32)
3672 jermar 107
	GENARCH_SOURCES += \
3923 svoboda 108
		port/dummy.c \
109
		ctl/stty.c
3672 jermar 110
endif
3923 svoboda 111
ifeq ($(UARCH), sparc64)
3754 svoboda 112
	GENARCH_SOURCES += \
3923 svoboda 113
		port/dummy.c \
114
		ctl/stty.c
3754 svoboda 115
endif
1707 palkovsky 116
 
3923 svoboda 117
# ifeq ($(UARCH), ia32)
118
# 	ARCH_SOURCES += \
119
# 		arch/$(UARCH)/src/mouse.c \
120
# 		arch/$(UARCH)/src/scanc.c
121
# 	GENARCH_SOURCES = \
122
# 		genarch/src/kbd.c
123
# 	CFLAGS += -DMOUSE_ENABLED
124
# endif
125
# ifeq ($(UARCH), ia64)
126
# 	ARCH_SOURCES += \
127
# 		arch/$(UARCH)/src/mouse.c \
128
# 		arch/$(UARCH)/src/scanc.c \
129
# 		arch/$(UARCH)/src/lkbd.c
130
# 	GENARCH_SOURCES = \
131
# 		genarch/src/kbd.c
132
# 	CFLAGS += -DMOUSE_ENABLED
133
# endif
134
# ifeq ($(UARCH), amd64)
135
# 	ARCH_SOURCES += \
136
# 		arch/$(UARCH)/src/mouse.c \
137
# 		arch/$(UARCH)/src/scanc.c
138
# 	GENARCH_SOURCES = \
139
# 		genarch/src/kbd.c
140
# 	CFLAGS += -DMOUSE_ENABLED
141
# endif
142
# ifeq ($(UARCH), sparc64)
143
# 	ARCH_SOURCES += \
144
# 		arch/$(UARCH)/src/scanc.c \
145
# 		arch/$(UARCH)/src/sgcn.c
146
# 	GENARCH_SOURCES = \
147
# 		genarch/src/kbd.c \
148
# 		genarch/src/nofb.c
149
# endif
150
# ifeq ($(UARCH), arm32)
151
# 	ARCH_SOURCES += \
152
# 		arch/$(UARCH)/src/kbd_gxemul.c
153
# endif
154
# ifeq ($(UARCH), mips32)
155
# 	GENARCH_SOURCES += \
156
# 	    genarch/src/nofb.c
157
# endif
158
# ifeq ($(UARCH), mips32eb)
159
# 	GENARCH_SOURCES += \
160
# 	    genarch/src/nofb.c
161
# endif
162
 
1339 cejka 163
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
164
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
1873 jermar 165
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
1339 cejka 166
 
3699 svoboda 167
OBJECTS := $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(GENARCH_OBJECTS)
168
 
1339 cejka 169
.PHONY: all clean depend disasm links
170
 
3201 svoboda 171
all: links $(OUTPUT) $(OUTPUT).disasm
1339 cejka 172
 
173
-include Makefile.depend
174
 
175
links:
3882 decky 176
	ln -sfn ../arch/$(UARCH)/include include/arch
1873 jermar 177
	ln -sfn ../genarch/include include/genarch
1339 cejka 178
 
179
clean:
3699 svoboda 180
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend include/arch include/genarch $(OBJECTS)
1339 cejka 181
 
182
depend:
183
	$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
184
 
3699 svoboda 185
$(OUTPUT): $(OBJECTS) $(LIBS)
3882 decky 186
	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
1339 cejka 187
 
3201 svoboda 188
disasm: $(OUTPUT).disasm
1339 cejka 189
 
3201 svoboda 190
$(OUTPUT).disasm: $(OUTPUT)
191
	$(OBJDUMP) -d $< >$@
192
 
1339 cejka 193
%.o: %.S
194
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
195
 
196
%.o: %.s
197
	$(AS) $(AFLAGS) $< -o $@
198
 
199
%.o: %.c
200
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@