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 = elf32-littlearm
-
 
40
BFD_ARCH = arm
35
TARGET = arm-linux-gnu
41
TARGET = arm-linux-gnu
36
TOOLCHAIN_DIR = /usr/local/arm/bin
42
TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin
37
 
43
 
38
ifeq ($(COMPILER),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
else
50
endif
-
 
51
 
-
 
52
ifeq ($(COMPILER),gcc_cross)
45
	CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
53
	CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
46
	AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
54
	AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
47
	LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
55
	LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
48
	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
56
	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
49
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
57
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
50
endif
58
endif
51
 
59
 
52
CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../.. -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 
60
CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -I../../.. -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -pipe
53
 
-
 
54
ifdef REVISION
-
 
55
	CFLAGS += "-DREVISION=\"$(REVISION)\""
-
 
56
endif
-
 
57
 
-
 
58
ifdef TIMESTAMP
-
 
59
	CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
-
 
60
endif
-
 
61
 
-
 
62
ifdef MACHINE
-
 
63
	CFLAGS += "-DMACHINE=$(MACHINE)"
-
 
64
endif
-
 
65
 
61
 
66
SOURCES = \
62
SOURCES = \
67
	main.c \
63
	main.c \
68
	boot.S \
64
	boot.S \
69
	asm.S \
65
	asm.S \
70
	mm.c \
66
	mm.c \
-
 
67
	print/gxemul.c \
-
 
68
	_components.c \
71
	../../../generic/printf.c \
69
	../../../generic/printf.c \
-
 
70
	../../../generic/string.c \
72
	../../../genarch/division.c
71
	../../../genarch/division.c
73
 
72
 
74
ifeq ($(MACHINE), gxemul_testarm)
-
 
75
	SOURCES += print/gxemul.c
-
 
76
endif
-
 
77
 
-
 
78
 
-
 
79
COMPONENTS = \
73
COMPONENTS = \
80
	$(KERNELDIR)/kernel.bin \
74
	$(KERNELDIR)/kernel.bin \
81
	$(USPACEDIR)/srv/ns/ns \
75
	$(USPACEDIR)/srv/ns/ns \
-
 
76
	$(USPACEDIR)/srv/loader/loader \
-
 
77
	$(USPACEDIR)/app/init/init \
-
 
78
	$(USPACEDIR)/srv/devmap/devmap \
-
 
79
	$(USPACEDIR)/srv/rd/rd \
-
 
80
	$(USPACEDIR)/srv/vfs/vfs
-
 
81
ifeq ($(RDFMT),tmpfs)
-
 
82
	COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs
-
 
83
endif
-
 
84
ifeq ($(RDFMT),fat)
-
 
85
	COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
-
 
86
endif
-
 
87
 
-
 
88
RD_SRVS = \
-
 
89
	$(USPACEDIR)/srv/fb/fb \
82
	$(USPACEDIR)/srv/kbd/kbd \
90
	$(USPACEDIR)/srv/kbd/kbd \
83
	$(USPACEDIR)/srv/console/console \
91
	$(USPACEDIR)/srv/console/console \
84
	$(USPACEDIR)/srv/fb/fb \
-
 
85
	$(USPACEDIR)/srv/vfs/vfs \
-
 
86
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
92
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
87
	$(USPACEDIR)/srv/fs/fat/fat \
93
	$(USPACEDIR)/srv/fs/fat/fat
-
 
94
 
88
	$(USPACEDIR)/srv/devmap/devmap \
95
RD_APPS = \
89
	$(USPACEDIR)/app/init/init \
96
	$(USPACEDIR)/app/tetris/tetris \
90
	$(USPACEDIR)/app/tester/tester \
97
	$(USPACEDIR)/app/tester/tester \
-
 
98
	$(USPACEDIR)/app/trace/trace \
91
	$(USPACEDIR)/app/klog/klog \
99
	$(USPACEDIR)/app/klog/klog \
92
	$(USPACEDIR)/app/tetris/tetris
100
	$(USPACEDIR)/app/bdsh/bdsh
93
 
101
 
94
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
102
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
95
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
103
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
96
 
104
 
97
.PHONY: all clean depend
105
.PHONY: all clean depend
98
 
106
 
99
all: image.boot
107
all: image.boot
100
 
108
 
101
-include Makefile.depend
109
-include Makefile.depend
102
 
110
 
103
image.boot: depend _components.h _link.ld $(OBJECTS) $(COMPONENT_OBJECTS)
111
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
104
	$(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@ 
112
	$(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@
105
 
113
 
106
depend:
114
depend:
107
	-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
115
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
108
 
116
 
109
clean:
117
clean:
-
 
118
	-for file in $(RD_SRVS) ; do \
-
 
119
		rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-
 
120
	done
-
 
121
	-for file in $(RD_APPS) ; do \
-
 
122
		rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
-
 
123
	done
110
	-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend 
124
	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend
111
 
125
 
112
_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
126
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
-
 
127
	for file in $(RD_SRVS) ; do \
-
 
128
		cp $$file $(USPACEDIR)/dist/srv/ ; \
-
 
129
	done
-
 
130
	for file in $(RD_APPS) ; do \
113
	./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS)
131
		cp $$file $(USPACEDIR)/dist/app/ ; \
-
 
132
	done
-
 
133
ifeq ($(RDFMT),tmpfs)
-
 
134
	../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
-
 
135
endif
-
 
136
ifeq ($(RDFMT),fat)
-
 
137
	../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs
-
 
138
endif
-
 
139
	../../../../tools/mkhord.py 4096 initrd.fs initrd.img
-
 
140
	rm initrd.fs
-
 
141
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) ./initrd.img
114
 
142
 
115
%.o: %.S
143
%.o: %.S
116
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
144
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
117
 
145
 
118
%.o: %.c
146
%.o: %.c