Subversion Repositories HelenOS

Rev

Rev 3022 | Rev 4420 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 25... Line 25...
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
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.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
include ../../../../version
29
include ../../../../version
30
include ../../../Makefile.config
30
-include ../../../../Makefile.config
31
 
31
 
32
## Toolchain configuration
32
## Toolchain configuration
33
#
33
#
34
 
34
 
-
 
35
ifndef CROSS_PREFIX
-
 
36
	CROSS_PREFIX = /usr/local
-
 
37
endif
-
 
38
 
-
 
39
BFD_NAME = elf64-ia64-little
-
 
40
BFD_ARCH = ia64
35
TARGET = ia64-pc-linux-gnu
41
TARGET = ia64-pc-linux-gnu
36
TOOLCHAIN_DIR = /usr/local/ia64/bin
42
TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64/bin
37
 
43
 
38
ifeq ($(COMPILER),gcc_native)
44
ifeq ($(COMPILER),gcc_native)
39
	CC = gcc
45
	CC = gcc
40
	AS = as
46
	AS = as
41
	LD = ld
47
	LD = ld
42
	OBJCOPY = objcopy
48
	OBJCOPY = objcopy
43
	OBJDUMP = objdump
49
	OBJDUMP = objdump
44
	GEFI_PREXIX = 
50
	GEFI_PREFIX =
45
endif
51
endif
46
 
52
 
47
ifeq ($(COMPILER),icc_native)
53
ifeq ($(COMPILER),icc_native)
48
	CC = icc
54
	CC = icc
49
	AS = as
55
	AS = as
Line 60... Line 66...
60
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
66
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
61
	GEFI_PREFIX = $(TOOLCHAIN_DIR)/$(TARGET)-
67
	GEFI_PREFIX = $(TOOLCHAIN_DIR)/$(TARGET)-
62
endif
68
endif
63
 
69
 
64
#-mno-pic means do not use gp + imm22 to address data
70
#-mno-pic means do not use gp + imm22 to address data
65
CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../../genarch -I../../../../kernel/generic/include -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic
71
CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -I../../../genarch -I../../../../kernel/generic/include -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -pipe
66
 
-
 
67
ifdef REVISION
-
 
68
	CFLAGS += "-DREVISION=\"$(REVISION)\""
-
 
69
endif
-
 
70
 
-
 
71
ifdef TIMESTAMP
-
 
72
	CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
-
 
73
endif
-
 
74
 
72
 
75
SOURCES = \
73
SOURCES = \
76
	main.c \
74
	main.c \
77
	../../../generic/printf.c \
75
	../../../generic/printf.c \
78
	../../../generic/string.c \
76
	../../../generic/string.c \
79
	../../../genarch/balloc.c \
77
	../../../genarch/balloc.c \
-
 
78
	_components.c \
80
	asm.S \
79
	asm.S \
81
	boot.S
80
	boot.S
82
 
81
 
-
 
82
NOCOMPONENTS = \
-
 
83
	$(KERNELDIR)/kernel.bin 
83
COMPONENTS = \
84
COMPONENTS = \
84
	$(KERNELDIR)/kernel.bin \
85
	$(KERNELDIR)/kernel.bin \
85
	$(USPACEDIR)/srv/ns/ns \
86
	$(USPACEDIR)/srv/ns/ns \
-
 
87
	$(USPACEDIR)/srv/loader/loader \
-
 
88
	$(USPACEDIR)/app/init/init \
-
 
89
	$(USPACEDIR)/srv/devmap/devmap \
-
 
90
	$(USPACEDIR)/srv/rd/rd \
-
 
91
	$(USPACEDIR)/srv/vfs/vfs
-
 
92
ifeq ($(RDFMT),tmpfs)
-
 
93
	COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs
-
 
94
endif
-
 
95
ifeq ($(RDFMT),fat)
-
 
96
	COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
-
 
97
endif
-
 
98
 
-
 
99
RD_SRVS = \
86
	$(USPACEDIR)/srv/fb/fb \
100
	$(USPACEDIR)/srv/fb/fb \
87
	$(USPACEDIR)/srv/kbd/kbd \
101
	$(USPACEDIR)/srv/kbd/kbd \
88
	$(USPACEDIR)/srv/console/console \
102
	$(USPACEDIR)/srv/console/console \
89
	$(USPACEDIR)/srv/vfs/vfs \
-
 
90
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
103
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
91
	$(USPACEDIR)/srv/fs/fat/fat \
104
	$(USPACEDIR)/srv/fs/fat/fat
92
	$(USPACEDIR)/srv/devmap/devmap \
-
 
-
 
105
 
93
	$(USPACEDIR)/app/init/init \
106
RD_APPS = \
94
	$(USPACEDIR)/app/tetris/tetris \
107
	$(USPACEDIR)/app/tetris/tetris \
95
	$(USPACEDIR)/app/tester/tester \
108
	$(USPACEDIR)/app/tester/tester \
-
 
109
	$(USPACEDIR)/app/trace/trace \
96
	$(USPACEDIR)/app/klog/klog
110
	$(USPACEDIR)/app/klog/klog \
97
 
-
 
-
 
111
	$(USPACEDIR)/app/bdsh/bdsh
98
 
112
 
99
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
113
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
100
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
114
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
101
 
115
 
102
.PHONY: all clean depend
116
.PHONY: all clean depend
103
 
117
 
104
all: hello.efi disasm
118
all: hello.efi disasm
105
 
119
 
106
-include Makefile.depend
120
-include Makefile.depend
107
 
121
 
108
 
-
 
109
hello.efi: image.boot
122
hello.efi: image.boot
110
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
123
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
111
	cp gefi/HelenOS/hello.efi ../../../../
124
	cp gefi/HelenOS/hello.efi ../../../../
112
#	cp gefi/HelenOS/hello.efi /boot/efi/
-
 
113
	cp gefi/HelenOS/image.bin ../../../../
125
	cp gefi/HelenOS/image.bin ../../../../
114
 
126
 
115
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS)
127
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
116
	$(LD) -Map boot.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
128
	$(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@
117
 
129
 
118
depend:
130
depend:
119
	-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
131
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
120
 
132
 
121
clean:
133
clean:
-
 
134
	-for file in $(RD_SRVS) ; do \
-
 
135
		rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-
 
136
	done
-
 
137
	-for file in $(RD_APPS) ; do \
-
 
138
		rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
-
 
139
	done
122
	-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend
140
	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) image.boot image.map image.disasm initrd.img image.boot Makefile.depend ../../../../image.bin ../../../../hello.efi
-
 
141
	make -C gefi clean
123
	make -C gefi/HelenOS clean
142
	make -C gefi/HelenOS clean
124
 
143
 
125
_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
144
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
-
 
145
	for file in $(RD_SRVS) ; do \
126
	./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS)
146
		cp $$file $(USPACEDIR)/dist/srv/ ; \
-
 
147
	done
-
 
148
	for file in $(RD_APPS) ; do \
-
 
149
		cp $$file $(USPACEDIR)/dist/app/ ; \
-
 
150
	done
-
 
151
ifeq ($(RDFMT),tmpfs)
-
 
152
	../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
-
 
153
endif
-
 
154
ifeq ($(RDFMT),fat)
-
 
155
	../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs
-
 
156
endif
-
 
157
	../../../../tools/mkhord.py 16384 initrd.fs initrd.img
-
 
158
	rm initrd.fs
-
 
159
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned long" $(COMPONENTS) ./initrd.img
127
 
160
 
128
%.o: %.S
161
%.o: %.S
129
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
162
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
130
 
163
 
131
%.o: %.c
164
%.o: %.c
132
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
165
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
133
 
166
 
134
disasm: image.boot
167
disasm: image.boot
135
	$(OBJDUMP) -d image.boot > boot.disasm
168
	$(OBJDUMP) -d image.boot > image.disasm