Subversion Repositories HelenOS

Rev

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

Rev 3597 Rev 4377
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
35
ifndef CROSS_PREFIX
Line 45... Line 45...
45
	CC = gcc
45
	CC = gcc
46
	AS = as
46
	AS = as
47
	LD = ld
47
	LD = ld
48
	OBJCOPY = objcopy
48
	OBJCOPY = objcopy
49
	OBJDUMP = objdump
49
	OBJDUMP = objdump
50
	GEFI_PREXIX = 
50
	GEFI_PREFIX =
51
endif
51
endif
52
 
52
 
53
ifeq ($(COMPILER),icc_native)
53
ifeq ($(COMPILER),icc_native)
54
	CC = icc
54
	CC = icc
55
	AS = as
55
	AS = as
Line 66... Line 66...
66
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
66
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
67
	GEFI_PREFIX = $(TOOLCHAIN_DIR)/$(TARGET)-
67
	GEFI_PREFIX = $(TOOLCHAIN_DIR)/$(TARGET)-
68
endif
68
endif
69
 
69
 
70
#-mno-pic means do not use gp + imm22 to address data
70
#-mno-pic means do not use gp + imm22 to address data
71
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 -pipe
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
72
 
-
 
73
ifdef REVISION
-
 
74
	CFLAGS += "-DREVISION=\"$(REVISION)\""
-
 
75
endif
-
 
76
 
-
 
77
ifdef TIMESTAMP
-
 
78
	CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
-
 
79
endif
-
 
80
 
72
 
81
SOURCES = \
73
SOURCES = \
82
	main.c \
74
	main.c \
83
	../../../generic/printf.c \
75
	../../../generic/printf.c \
84
	../../../generic/string.c \
76
	../../../generic/string.c \
85
	../../../genarch/balloc.c \
77
	../../../genarch/balloc.c \
86
	_components.c \
78
	_components.c \
87
	asm.S \
79
	asm.S \
88
	boot.S
80
	boot.S
89
 
81
 
90
COMPONENTS = \
-
 
91
	$(KERNELDIR)/kernel.bin 
-
 
92
NOCOMPONENTS = \
82
NOCOMPONENTS = \
-
 
83
	$(KERNELDIR)/kernel.bin 
-
 
84
COMPONENTS = \
93
	$(KERNELDIR)/kernel.bin \
85
	$(KERNELDIR)/kernel.bin \
94
	$(USPACEDIR)/srv/ns/ns \
86
	$(USPACEDIR)/srv/ns/ns \
95
	$(USPACEDIR)/srv/loader/loader \
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 = \
96
	$(USPACEDIR)/srv/fb/fb \
100
	$(USPACEDIR)/srv/fb/fb \
97
	$(USPACEDIR)/srv/kbd/kbd \
101
	$(USPACEDIR)/srv/kbd/kbd \
98
	$(USPACEDIR)/srv/console/console \
102
	$(USPACEDIR)/srv/console/console \
99
	$(USPACEDIR)/srv/vfs/vfs \
-
 
100
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
103
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
101
	$(USPACEDIR)/srv/fs/fat/fat \
104
	$(USPACEDIR)/srv/fs/fat/fat
102
	$(USPACEDIR)/srv/devmap/devmap \
-
 
-
 
105
 
103
	$(USPACEDIR)/app/init/init \
106
RD_APPS = \
104
	$(USPACEDIR)/app/trace/trace \
107
	$(USPACEDIR)/app/trace/trace \
105
	$(USPACEDIR)/app/tetris/tetris \
108
	$(USPACEDIR)/app/tetris/tetris \
106
	$(USPACEDIR)/app/tester/tester \
109
	$(USPACEDIR)/app/tester/tester \
107
	$(USPACEDIR)/app/klog/klog
110
	$(USPACEDIR)/app/klog/klog \
-
 
111
	$(USPACEDIR)/app/bdsh/bdsh
108
 
112
 
109
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
113
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
110
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
114
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
111
 
115
 
112
.PHONY: all clean depend
116
.PHONY: all clean depend
Line 116... Line 120...
116
-include Makefile.depend
120
-include Makefile.depend
117
 
121
 
118
hello.efi: image.boot
122
hello.efi: image.boot
119
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
123
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
120
	cp gefi/HelenOS/hello.efi ../../../../
124
	cp gefi/HelenOS/hello.efi ../../../../
121
#	cp gefi/HelenOS/hello.efi /boot/efi/
-
 
122
	cp gefi/HelenOS/image.bin ../../../../
125
	cp gefi/HelenOS/image.bin ../../../../
123
 
126
 
124
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS)
127
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
125
	$(LD) -Map image.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 $@
126
 
129
 
127
depend:
130
depend:
128
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
131
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
129
 
132
 
130
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
131
	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot image.map image.disasm Makefile.depend ../../../../image.bin ../../../../hello.efi
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
132
	make -C gefi clean
141
	make -C gefi clean
133
	make -C gefi/HelenOS clean
142
	make -C gefi/HelenOS clean
134
 
143
 
135
_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
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 \
-
 
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
136
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned long" $(COMPONENTS)
159
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned long" $(COMPONENTS) ./initrd.img
137
 
160
 
138
%.o: %.S
161
%.o: %.S
139
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
162
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
140
 
163
 
141
%.o: %.c
164
%.o: %.c