Subversion Repositories HelenOS

Rev

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

Rev 3386 Rev 4153
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
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
 
-
 
82
NOCOMPONENTS = \
-
 
83
	$(KERNELDIR)/kernel.bin 
90
COMPONENTS = \
84
COMPONENTS = \
91
	$(KERNELDIR)/kernel.bin \
85
	$(KERNELDIR)/kernel.bin \
92
	$(USPACEDIR)/srv/ns/ns \
86
	$(USPACEDIR)/srv/ns/ns \
93
	$(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 = \
94
	$(USPACEDIR)/srv/fb/fb \
100
	$(USPACEDIR)/srv/fb/fb \
95
	$(USPACEDIR)/srv/kbd/kbd \
101
	$(USPACEDIR)/srv/kbd/kbd \
96
	$(USPACEDIR)/srv/console/console \
102
	$(USPACEDIR)/srv/console/console \
97
	$(USPACEDIR)/srv/vfs/vfs \
-
 
98
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
103
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
99
	$(USPACEDIR)/srv/fs/fat/fat \
104
	$(USPACEDIR)/srv/fs/fat/fat
100
	$(USPACEDIR)/srv/devmap/devmap \
-
 
-
 
105
 
101
	$(USPACEDIR)/app/init/init \
106
RD_APPS = \
102
	$(USPACEDIR)/app/tetris/tetris \
107
	$(USPACEDIR)/app/tetris/tetris \
103
	$(USPACEDIR)/app/tester/tester \
108
	$(USPACEDIR)/app/tester/tester \
-
 
109
	$(USPACEDIR)/app/trace/trace \
104
	$(USPACEDIR)/app/klog/klog
110
	$(USPACEDIR)/app/klog/klog \
-
 
111
	$(USPACEDIR)/app/bdsh/bdsh
105
 
112
 
106
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
113
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
107
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
114
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
108
 
115
 
109
.PHONY: all clean depend
116
.PHONY: all clean depend
Line 113... Line 120...
113
-include Makefile.depend
120
-include Makefile.depend
114
 
121
 
115
hello.efi: image.boot
122
hello.efi: image.boot
116
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
123
	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
117
	cp gefi/HelenOS/hello.efi ../../../../
124
	cp gefi/HelenOS/hello.efi ../../../../
118
#	cp gefi/HelenOS/hello.efi /boot/efi/
-
 
119
	cp gefi/HelenOS/image.bin ../../../../
125
	cp gefi/HelenOS/image.bin ../../../../
120
 
126
 
121
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS)
127
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
122
	$(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 $@
123
 
129
 
124
depend:
130
depend:
125
	-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
131
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
126
 
132
 
127
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
128
	-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
129
	make -C gefi clean
141
	make -C gefi clean
130
	make -C gefi/HelenOS clean
142
	make -C gefi/HelenOS clean
131
 
143
 
132
_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
133
	../../../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
134
 
160
 
135
%.o: %.S
161
%.o: %.S
136
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
162
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
137
 
163
 
138
%.o: %.c
164
%.o: %.c