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-powerpc |
|
- | 40 | BFD_ARCH = powerpc:common |
|
35 | TARGET = ppc-linux-gnu |
41 | TARGET = ppc-linux-gnu |
36 | TOOLCHAIN_DIR = /usr/local/ppc/bin |
42 | TOOLCHAIN_DIR = $(CROSS_PREFIX)/ppc/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=powerpc -msoft-float -m32 |
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=powerpc -msoft-float -m32 -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 \ |
74 | ofwarch.c \ |
64 | ofwarch.c \ |
- | 65 | _components.c \ |
|
75 | ../../../genarch/ofw.c \ |
66 | ../../../genarch/ofw.c \ |
76 | ../../../generic/printf.c \ |
67 | ../../../generic/printf.c \ |
- | 68 | ../../../generic/string.c \ |
|
77 | asm.S \ |
69 | asm.S \ |
78 | boot.S |
70 | boot.S |
79 | 71 | ||
80 | COMPONENTS = \ |
72 | COMPONENTS = \ |
81 | $(KERNELDIR)/kernel.bin \ |
73 | $(KERNELDIR)/kernel.bin \ |
82 | $(USPACEDIR)/srv/ns/ns \ |
74 | $(USPACEDIR)/srv/ns/ns \ |
- | 75 | $(USPACEDIR)/srv/loader/loader \ |
|
- | 76 | $(USPACEDIR)/app/init/init \ |
|
- | 77 | $(USPACEDIR)/srv/devmap/devmap \ |
|
- | 78 | $(USPACEDIR)/srv/rd/rd \ |
|
- | 79 | $(USPACEDIR)/srv/vfs/vfs |
|
- | 80 | ifeq ($(RDFMT),tmpfs) |
|
- | 81 | COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs |
|
- | 82 | endif |
|
- | 83 | ifeq ($(RDFMT),fat) |
|
- | 84 | COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat |
|
- | 85 | endif |
|
- | 86 | ||
- | 87 | RD_SRVS = \ |
|
83 | $(USPACEDIR)/srv/fb/fb \ |
88 | $(USPACEDIR)/srv/fb/fb \ |
84 | $(USPACEDIR)/srv/kbd/kbd \ |
89 | $(USPACEDIR)/srv/kbd/kbd \ |
85 | $(USPACEDIR)/srv/console/console \ |
90 | $(USPACEDIR)/srv/console/console \ |
86 | $(USPACEDIR)/srv/vfs/vfs \ |
- | |
87 | $(USPACEDIR)/srv/fs/tmpfs/tmpfs \ |
91 | $(USPACEDIR)/srv/fs/tmpfs/tmpfs \ |
88 | $(USPACEDIR)/srv/fs/fat/fat \ |
92 | $(USPACEDIR)/srv/fs/fat/fat |
89 | $(USPACEDIR)/srv/devmap/devmap \ |
- | |
- | 93 | ||
90 | $(USPACEDIR)/app/init/init \ |
94 | RD_APPS = \ |
91 | $(USPACEDIR)/app/tetris/tetris \ |
95 | $(USPACEDIR)/app/tetris/tetris \ |
92 | $(USPACEDIR)/app/tester/tester \ |
96 | $(USPACEDIR)/app/tester/tester \ |
- | 97 | $(USPACEDIR)/app/trace/trace \ |
|
93 | $(USPACEDIR)/app/klog/klog |
98 | $(USPACEDIR)/app/klog/klog \ |
- | 99 | $(USPACEDIR)/app/bdsh/bdsh |
|
94 | 100 | ||
95 | OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
101 | OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
96 | COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) |
102 | COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) |
97 | 103 | ||
98 | .PHONY: all clean depend |
104 | .PHONY: all clean depend |
99 | 105 | ||
100 | all: image.boot |
106 | all: image.boot |
101 | 107 | ||
102 | -include Makefile.depend |
108 | -include Makefile.depend |
103 | 109 | ||
104 | image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) |
110 | image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) |
105 | $(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@ |
111 | $(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@ |
106 | 112 | ||
107 | depend: |
113 | depend: |
108 | -makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null |
114 | -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null |
109 | 115 | ||
110 | clean: |
116 | clean: |
- | 117 | -for file in $(RD_SRVS) ; do \ |
|
- | 118 | rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ |
|
- | 119 | done |
|
- | 120 | -for file in $(RD_APPS) ; do \ |
|
- | 121 | rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ |
|
- | 122 | done |
|
111 | -rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend |
123 | -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend |
112 | 124 | ||
113 | _components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) |
125 | _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in |
- | 126 | for file in $(RD_SRVS) ; do \ |
|
- | 127 | cp $$file $(USPACEDIR)/dist/srv/ ; \ |
|
- | 128 | done |
|
- | 129 | for file in $(RD_APPS) ; do \ |
|
114 | ./pack $(OBJCOPY) $(COMPONENTS) |
130 | cp $$file $(USPACEDIR)/dist/app/ ; \ |
- | 131 | done |
|
- | 132 | ifeq ($(RDFMT),tmpfs) |
|
- | 133 | ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs |
|
- | 134 | endif |
|
- | 135 | ifeq ($(RDFMT),fat) |
|
- | 136 | ../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs |
|
- | 137 | endif |
|
- | 138 | ../../../../tools/mkhord.py 4096 initrd.fs initrd.img |
|
- | 139 | rm initrd.fs |
|
- | 140 | ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) ./initrd.img |
|
115 | 141 | ||
116 | %.o: %.S |
142 | %.o: %.S |
117 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
143 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
118 | 144 | ||
119 | %.o: %.c |
145 | %.o: %.c |