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 55... Line 55...
55
	LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
55
	LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
56
	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
56
	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
57
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
57
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
58
endif
58
endif
59
 
59
 
60
CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../../genarch -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=ultrasparc -m64
60
CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -I../../../genarch -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=ultrasparc -m64 -mno-fpu -pipe
61
 
-
 
62
ifdef REVISION
-
 
63
	CFLAGS += "-DREVISION=\"$(REVISION)\""
-
 
64
endif
-
 
65
 
-
 
66
ifdef TIMESTAMP
-
 
67
	CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
-
 
68
endif
-
 
69
 
61
 
70
SOURCES = \
62
SOURCES = \
71
	main.c \
63
	main.c \
72
	_components.c \
64
	_components.c \
73
	../../../generic/printf.c \
65
	../../../generic/printf.c \
Line 77... Line 69...
77
	../../../genarch/ofw_tree.c \
69
	../../../genarch/ofw_tree.c \
78
	ofwarch.c \
70
	ofwarch.c \
79
	asm.S \
71
	asm.S \
80
	boot.S
72
	boot.S
81
 
73
 
-
 
74
#
-
 
75
# All components that go to image.boot without the ramdisk.
-
 
76
#
82
COMPONENTS = \
77
COMPONENTS = \
83
	$(KERNELDIR)/kernel.bin \
78
	$(KERNELDIR)/kernel.bin \
84
	$(USPACEDIR)/srv/ns/ns \
79
	$(USPACEDIR)/srv/ns/ns \
85
	$(USPACEDIR)/app/init/init \
80
	$(USPACEDIR)/app/init/init \
86
	$(USPACEDIR)/srv/loader/loader \
81
	$(USPACEDIR)/srv/loader/loader \
Line 92... Line 87...
92
endif
87
endif
93
ifeq ($(RDFMT),fat)
88
ifeq ($(RDFMT),fat)
94
	COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
89
	COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
95
endif
90
endif
96
 
91
 
-
 
92
#
-
 
93
# Final list of all components that go to image.boot.
-
 
94
#
-
 
95
ALL_COMPONENTS = $(COMPONENTS)
-
 
96
ifeq ($(CONFIG_RD_EXTERNAL),n)
-
 
97
	ALL_COMPONENTS += ./initrd.img
-
 
98
endif
-
 
99
 
97
RD_TASKS = \
100
RD_SRVS = \
98
	$(USPACEDIR)/srv/fb/fb \
101
	$(USPACEDIR)/srv/fb/fb \
99
	$(USPACEDIR)/srv/kbd/kbd \
102
	$(USPACEDIR)/srv/kbd/kbd \
100
	$(USPACEDIR)/srv/console/console \
103
	$(USPACEDIR)/srv/console/console \
101
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
104
	$(USPACEDIR)/srv/fs/tmpfs/tmpfs
-
 
105
 
-
 
106
ifeq ($(MACHINE),generic)
-
 
107
RD_SRVS += \
102
	$(USPACEDIR)/srv/fs/fat/fat \
108
	$(USPACEDIR)/srv/fs/fat/fat \
-
 
109
	$(USPACEDIR)/srv/fhc/fhc \
-
 
110
	$(USPACEDIR)/srv/obio/obio
-
 
111
endif
-
 
112
 
-
 
113
RD_APPS = \
103
	$(USPACEDIR)/app/tetris/tetris \
114
	$(USPACEDIR)/app/tetris/tetris \
104
	$(USPACEDIR)/app/tester/tester \
115
	$(USPACEDIR)/app/trace/trace \
105
	$(USPACEDIR)/app/bdsh/bdsh \
116
	$(USPACEDIR)/app/bdsh/bdsh \
106
	$(USPACEDIR)/app/klog/klog
117
	$(USPACEDIR)/app/klog/klog
107
 
118
 
-
 
119
ifeq ($(MACHINE),generic)
-
 
120
RD_APPS += \
-
 
121
	$(USPACEDIR)/app/tester/tester
-
 
122
endif
-
 
123
 
108
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
124
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
109
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
125
ALL_COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(ALL_COMPONENTS))))
110
 
126
 
111
.PHONY: all clean depend
127
.PHONY: all clean depend
112
 
128
 
113
all: image.boot disasm
129
all: image.boot disasm
114
 
130
 
115
-include Makefile.depend
131
-include Makefile.depend
116
 
132
 
117
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
133
image.boot: depend _components.h _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS)
118
	$(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@
134
	$(LD) -Map image.map -no-check-sections -N -T _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) -o $@
119
 
135
 
120
depend:
136
depend:
121
	-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
137
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
122
 
138
 
123
clean:
139
clean:
124
	-for task in $(RD_TASKS) ; do \
140
	-for file in $(RD_SRVS) ; do \
125
		rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
141
		rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
126
	done
142
	done
-
 
143
	-for file in $(RD_APPS) ; do \
-
 
144
		rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
-
 
145
	done
127
	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
146
	-rm -f _components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
128
 
147
 
129
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_TASKS) _link.ld.in
148
_components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS): $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
-
 
149
	for file in $(RD_SRVS) ; do \
-
 
150
		cp $$file $(USPACEDIR)/dist/srv/ ; \
-
 
151
	done
130
	for task in $(RD_TASKS) ; do \
152
	for file in $(RD_APPS) ; do \
131
		cp $$task $(USPACEDIR)/dist/sbin/ ; \
153
		cp $$file $(USPACEDIR)/dist/app/ ; \
132
	done
154
	done
133
ifeq ($(RDFMT),tmpfs)
155
ifeq ($(RDFMT),tmpfs)
134
	../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
156
	../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
135
endif
157
endif
136
ifeq ($(RDFMT),fat)
158
ifeq ($(RDFMT),fat)
137
	../../../../tools/mkfat.sh $(USPACEDIR)/dist/ initrd.fs
159
	../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs
138
endif
160
endif
139
	../../../../tools/mkhord.py 16384 initrd.fs initrd.img
161
	../../../../tools/mkhord.py 16384 initrd.fs initrd.img
140
	rm initrd.fs
162
	rm initrd.fs
141
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS) ./initrd.img
163
	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(ALL_COMPONENTS)
142
 
164
 
143
%.o: %.S
165
%.o: %.S
144
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
166
	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
145
 
167
 
146
%.o: %.c
168
%.o: %.c