Rev 3022 | Rev 4156 | 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-sparc |
|
| - | 40 | BFD_ARCH = sparc |
|
| 35 | TARGET = sparc64-linux-gnu |
41 | TARGET = sparc64-linux-gnu |
| 36 | TOOLCHAIN_DIR = /usr/local/sparc64/bin |
42 | TOOLCHAIN_DIR = $(CROSS_PREFIX)/sparc64/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 | endif |
50 | endif |
| 45 | 51 | ||
| 46 | ifeq ($(COMPILER),icc_native) |
- | |
| 47 | CC = icc |
- | |
| 48 | AS = as |
- | |
| 49 | LD = ld |
- | |
| 50 | OBJCOPY = objcopy |
- | |
| 51 | OBJDUMP = objdump |
- | |
| 52 | endif |
- | |
| 53 | - | ||
| 54 | ifeq ($(COMPILER),gcc_cross) |
52 | ifeq ($(COMPILER),gcc_cross) |
| 55 | CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc |
53 | CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc |
| 56 | AS = $(TOOLCHAIN_DIR)/$(TARGET)-as |
54 | AS = $(TOOLCHAIN_DIR)/$(TARGET)-as |
| 57 | LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld |
55 | LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld |
| 58 | OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy |
56 | OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy |
| 59 | OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
57 | OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
| 60 | endif |
58 | endif |
| 61 | 59 | ||
| 62 | 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 |
| 63 | - | ||
| 64 | ifdef REVISION |
- | |
| 65 | CFLAGS += "-DREVISION=\"$(REVISION)\"" |
- | |
| 66 | endif |
- | |
| 67 | - | ||
| 68 | ifdef TIMESTAMP |
- | |
| 69 | CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
- | |
| 70 | endif |
- | |
| 71 | 61 | ||
| 72 | SOURCES = \ |
62 | SOURCES = \ |
| 73 | main.c \ |
63 | main.c \ |
| - | 64 | _components.c \ |
|
| 74 | ../../../generic/printf.c \ |
65 | ../../../generic/printf.c \ |
| 75 | ../../../generic/string.c \ |
66 | ../../../generic/string.c \ |
| 76 | ../../../genarch/balloc.c \ |
67 | ../../../genarch/balloc.c \ |
| 77 | ../../../genarch/ofw.c \ |
68 | ../../../genarch/ofw.c \ |
| 78 | ../../../genarch/ofw_tree.c \ |
69 | ../../../genarch/ofw_tree.c \ |
| 79 | ofwarch.c \ |
70 | ofwarch.c \ |
| 80 | asm.S \ |
71 | asm.S \ |
| 81 | boot.S |
72 | boot.S |
| 82 | 73 | ||
| - | 74 | # |
|
| - | 75 | # All components that go to image.boot without the ramdisk. |
|
| - | 76 | # |
|
| 83 | COMPONENTS = \ |
77 | COMPONENTS = \ |
| 84 | $(KERNELDIR)/kernel.bin \ |
78 | $(KERNELDIR)/kernel.bin \ |
| 85 | $(USPACEDIR)/srv/ns/ns \ |
79 | $(USPACEDIR)/srv/ns/ns \ |
| - | 80 | $(USPACEDIR)/app/init/init \ |
|
| - | 81 | $(USPACEDIR)/srv/loader/loader \ |
|
| - | 82 | $(USPACEDIR)/srv/devmap/devmap \ |
|
| - | 83 | $(USPACEDIR)/srv/rd/rd \ |
|
| - | 84 | $(USPACEDIR)/srv/vfs/vfs |
|
| - | 85 | ifeq ($(RDFMT),tmpfs) |
|
| - | 86 | COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs |
|
| - | 87 | endif |
|
| - | 88 | ifeq ($(RDFMT),fat) |
|
| - | 89 | COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat |
|
| - | 90 | endif |
|
| - | 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 | ||
| - | 100 | RD_SRVS = \ |
|
| 86 | $(USPACEDIR)/srv/fb/fb \ |
101 | $(USPACEDIR)/srv/fb/fb \ |
| 87 | $(USPACEDIR)/srv/kbd/kbd \ |
102 | $(USPACEDIR)/srv/kbd/kbd \ |
| 88 | $(USPACEDIR)/srv/console/console \ |
103 | $(USPACEDIR)/srv/console/console \ |
| 89 | $(USPACEDIR)/srv/vfs/vfs \ |
- | |
| 90 | $(USPACEDIR)/srv/fs/tmpfs/tmpfs \ |
104 | $(USPACEDIR)/srv/fs/tmpfs/tmpfs \ |
| 91 | $(USPACEDIR)/srv/fs/fat/fat \ |
105 | $(USPACEDIR)/srv/fs/fat/fat \ |
| 92 | $(USPACEDIR)/srv/devmap/devmap \ |
106 | $(USPACEDIR)/srv/fhc/fhc \ |
| 93 | $(USPACEDIR)/app/init/init \ |
107 | $(USPACEDIR)/srv/obio/obio |
| - | 108 | ||
| - | 109 | RD_APPS = \ |
|
| 94 | $(USPACEDIR)/app/tetris/tetris \ |
110 | $(USPACEDIR)/app/tetris/tetris \ |
| 95 | $(USPACEDIR)/app/tester/tester \ |
111 | $(USPACEDIR)/app/tester/tester \ |
| - | 112 | $(USPACEDIR)/app/trace/trace \ |
|
| - | 113 | $(USPACEDIR)/app/bdsh/bdsh \ |
|
| 96 | $(USPACEDIR)/app/klog/klog |
114 | $(USPACEDIR)/app/klog/klog |
| 97 | 115 | ||
| 98 | OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
116 | OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
| 99 | COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) |
117 | ALL_COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(ALL_COMPONENTS)))) |
| 100 | 118 | ||
| 101 | .PHONY: all clean depend |
119 | .PHONY: all clean depend |
| 102 | 120 | ||
| 103 | all: image.boot disasm |
121 | all: image.boot disasm |
| 104 | 122 | ||
| 105 | -include Makefile.depend |
123 | -include Makefile.depend |
| 106 | 124 | ||
| 107 | image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) |
125 | image.boot: depend _components.h _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) |
| 108 | $(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@ |
126 | $(LD) -Map image.map -no-check-sections -N -T _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) -o $@ |
| 109 | 127 | ||
| 110 | depend: |
128 | depend: |
| 111 | -makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null |
129 | -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null |
| 112 | 130 | ||
| 113 | clean: |
131 | clean: |
| - | 132 | -for file in $(RD_SRVS) ; do \ |
|
| - | 133 | rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ |
|
| - | 134 | done |
|
| - | 135 | -for file in $(RD_APPS) ; do \ |
|
| - | 136 | rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ |
|
| - | 137 | done |
|
| 114 | -rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend |
138 | -rm -f _components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend |
| 115 | 139 | ||
| 116 | _components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) |
140 | _components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS): $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in |
| - | 141 | for file in $(RD_SRVS) ; do \ |
|
| - | 142 | cp $$file $(USPACEDIR)/dist/srv/ ; \ |
|
| - | 143 | done |
|
| - | 144 | for file in $(RD_APPS) ; do \ |
|
| 117 | ./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS) |
145 | cp $$file $(USPACEDIR)/dist/app/ ; \ |
| - | 146 | done |
|
| - | 147 | ifeq ($(RDFMT),tmpfs) |
|
| - | 148 | ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs |
|
| - | 149 | endif |
|
| - | 150 | ifeq ($(RDFMT),fat) |
|
| - | 151 | ../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs |
|
| - | 152 | endif |
|
| - | 153 | ../../../../tools/mkhord.py 16384 initrd.fs initrd.img |
|
| - | 154 | rm initrd.fs |
|
| - | 155 | ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(ALL_COMPONENTS) |
|
| 118 | 156 | ||
| 119 | %.o: %.S |
157 | %.o: %.S |
| 120 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
158 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
| 121 | 159 | ||
| 122 | %.o: %.c |
160 | %.o: %.c |
| 123 | $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
161 | $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
| 124 | 162 | ||
| 125 | disasm: image.boot |
163 | disasm: image.boot |
| 126 | $(OBJDUMP) -d image.boot > boot.disasm |
164 | $(OBJDUMP) -d image.boot > image.disasm |