Subversion Repositories HelenOS

Rev

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

Rev 454 Rev 455
Line 44... Line 44...
44
endif
44
endif
45
 
45
 
46
## Common compiler flags
46
## Common compiler flags
47
#
47
#
48
 
48
 
-
 
49
DEFS = -DARCH=$(ARCH)
49
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Igeneric/include/
50
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Igeneric/include/
50
LFLAGS = -M
51
LFLAGS = -M
-
 
52
AFLAGS = 
51
 
53
 
52
## Setup kernel configuration
54
## Setup kernel configuration
53
#
55
#
54
 
56
 
55
include Makefile.config
57
include Makefile.config
Line 126... Line 128...
126
all: kernel.bin boot
128
all: kernel.bin boot
127
 
129
 
128
-include Makefile.depend
130
-include Makefile.depend
129
 
131
 
130
clean:
132
clean:
131
	find generic/src/ arch/$(ARCH)/src/ genarch/src/ -name '*.o' -exec rm \{\} \;
-
 
132
	-rm -f kernel.bin kernel.map kernel.map.pre kernel.objdump generic/src/debug/real_map.bin Makefile.depend generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld
133
	-rm -f kernel.bin kernel.map kernel.map.pre kernel.objdump generic/src/debug/real_map.bin Makefile.depend generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld
-
 
134
	find generic/src/ arch/$(ARCH)/src/ genarch/src/ -name '*.o' -exec rm \{\} \;
133
	$(MAKE) -C arch/$(ARCH)/boot clean
135
	$(MAKE) -C arch/$(ARCH)/boot clean
134
 
136
 
135
config:
137
config:
136
	ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch
138
	ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch
137
	ln -sfn ../../genarch/include/ generic/include/genarch
139
	ln -sfn ../../genarch/include/ generic/include/genarch
138
 
140
 
139
depend: config
141
depend: config
140
	$(CC) $(CFLAGS) -M $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend
142
	$(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend
141
 
143
 
142
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
144
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
143
	$(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
145
	$(CC) $(DEFS) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
144
 
146
 
145
generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
147
generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
146
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o
148
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o
147
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre
149
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre
148
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
150
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
Line 153... Line 155...
153
 
155
 
154
kernel.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
156
kernel.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
155
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
157
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
156
 
158
 
157
boot: kernel.bin
159
boot: kernel.bin
158
	$(MAKE) -C arch/$(ARCH)/boot build KERNEL_SIZE="`cat kernel.bin | wc -c`"
160
	$(MAKE) -C arch/$(ARCH)/boot build KERNEL_SIZE="`cat kernel.bin | wc -c`" CC=$(CC) AS=$(AS) LD=$(LD)
159
 
161
 
160
%.o: %.S
162
%.o: %.S
161
	$(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@
163
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -c $< -o $@
162
 
164
 
163
%.o: %.s
165
%.o: %.s
164
	$(AS) $(ASFLAGS) $< -o $@
166
	$(AS) $(AFLAGS) $< -o $@
165
 
167
 
166
%.o: %.c
168
%.o: %.c
167
	$(CC) $(CFLAGS) -c $< -o $@
169
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@