summaryrefslogtreecommitdiff
path: root/viengoos/Makefile.am
blob: 2527f8c79d75d5b465dee2e13f389f9cd9ec30bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Makefile.am - Makefile template for viengoos.
# Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
# Written by Marcus Brinkmann.
#
# This file is part of the GNU Hurd.
# 
# The GNU Hurd is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This GNU Hurd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

if ARCH_IA32
  arch=ia32
  arch_src := ia32-output.c ia32-crt0.S ia32-cmain.c
endif
if ARCH_X86_64
  arch=x86_64
  arch_src := x86_64-output.c boot.S boot32.c boot64.c crt0.S \
	gdt.c tss.c idt.c pic.c timer-arch.c syscall.c thread-arch.c
endif


# The source files are scattered over several directories.  Add 
# all these directories to the vpath.
SYSDEP_PATH = $(srcdir)/sysdeps/${arch} \
	$(srcdir)/sysdeps/generic \
	$(srcdir)
VPATH = $(SYSDEP_PATH)

bootdir = $(prefix)/boot
if ! ENABLE_TESTS
boot_PROGRAMS = viengoos

all-local: viengoos.stripped
viengoos.stripped: viengoos
	strip -o $@ $<

# If we use viengoos_CPPFLAGS, then automake generates special rules
# that hardcode the source essentially ignoring the VPATH.  That's
# annoying.  This doesn't happen if we use AM_CPPFLAGS.
AM_CPPFLAGS = $(addprefix -I, $(SYSDEP_PATH)) $(KERNEL_CPPFLAGS)
AM_CFLAGS = $(KERNEL_CFLAGS)
viengoos_SOURCES =                              \
	output.h output.c output-none.c		\
	debug.h debug.c				\
	shutdown.h shutdown.c arch-shutdown.c	\
	panic.c					\
	sigma0.h sigma0.c			\
	zalloc.h zalloc.c			\
	viengoos.h viengoos.c			\
	boot-modules.h boot-modules.c		\
	memory.h memory.c			\
	object.h object.c			\
	cap.h cap.c 				\
	activity.h activity.c			\
	thread.h thread.c			\
	messenger.h messenger.c			\
	ager.h ager.c				\
	bits.h					\
	server.h server.c			\
	pager.h pager.c				\
	list.h					\
	scheduler.c				\
	bottom-half.h bottom-half.c		\
	timer.c					\
						\
	output-vga.c output-serial.c		\
	multiboot.h				\
	vm.h vm.c				\
						\
	${arch_src}

viengoos_LDADD =				\
	../libhurd-btree/libhurd-btree-kernel.a	\
	../libhurd-ihash/libhurd-ihash-kernel.a	\
	../libhurd-slab/libhurd-slab-kernel.a	\
	../libhurd-mm/libas-kernel.a		\
	../libc-parts/libc-kernel.a		\
	../libhurd-mm/libas-kernel.a		\
	../newlib/libc-routines.a		\
	-lgcc
viengoos_LDFLAGS = -N -nostdlib -T $(srcdir)/sysdeps/${arch}/kernel.lds
endif

if ARCH_X86_64
# This is highly discouraged, but the usual hack-around does not work as we
# have not only an additional flag but also must convert the object.
# This conversion basically means that we pretend the object contains 64 bit
# code to link it with the rest of the kernel and that we rename all
# sections to begin with .low. so that they are linked at a low address.
boot32.o: boot32.c
	$(filter-out -mcmodel=kernel,$(COMPILE)) -fno-stack-protector -std=gnu99 -m32 -c -o $@ $<
	$(OBJCOPY) -O elf64-x86-64 --prefix-sections .low $@ $@
endif


if ENABLE_TESTS
TESTS = t-as t-activity t-link t-guard
check_PROGRAMS = $(TESTS)

CHECK_CPPFLAGS += \
	-DRM_INTERN \
	-include $(srcdir)/t-environment.h
CHECK_LDADD = \
	../libhurd-btree/libhurd-btree.a \
	../libhurd-ihash/libhurd-ihash-nomalloc.a

t_as_CPPFLAGS = $(CHECK_CPPFLAGS)
t_as_CFLAGS = $(CHECK_CFLAGS)
t_as_SOURCES = t-as.c				\
	zalloc.h zalloc.c			\
	memory.h memory.c			\
	cap.h cap.c 				\
	object.h object.c			\
	activity.h activity.c			\
	thread.h thread.c			\
	output.h output.c output-stdio.c	\
	shutdown.h shutdown.c			\
	panic.c					\
	debug.h debug.c
t_as_LDADD = ../libhurd-mm/libas-check.a $(CHECK_LDADD)

t_activity_CPPFLAGS = $(CHECK_CPPFLAGS)
t_activity_CFLAGS = $(CHECK_CFLAGS)
t_activity_SOURCES = t-activity.c		\
	zalloc.h zalloc.c			\
	memory.h memory.c			\
	cap.h cap.c 				\
	object.h object.c			\
	activity.h activity.c			\
	thread.h thread.c			\
	output.h output.c output-stdio.c	\
	shutdown.h shutdown.c			\
	panic.c					\
	debug.h debug.c
t_activity_LDADD = ../libhurd-mm/libas-check.a $(CHECK_LDADD)

t_link_CPPFLAGS = $(CHECK_CPPFLAGS)
t_link_CFLAGS = $(CHECK_CFLAGS)
t_link_SOURCES = t-link.c list.h		\
	output.h output.c output-stdio.c panic.c shutdown.h shutdown.c

t_guard_CPPFLAGS = $(CHECK_CPPFLAGS)
t_guard_CFLAGS = $(CHECK_CFLAGS)
t_guard_SOURCES = t-guard.c			\
	output.h output.c output-stdio.c panic.c shutdown.h shutdown.c
endif