diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 77ba4f2b7..0324898d3 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -23,16 +23,6 @@ kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wn kernel_img_LDFLAGS = $(COMMON_LDFLAGS) TARGET_NO_STRIP = yes -noinst_MODULES = emu-full.mod -emu_full_mod_SOURCES = kern/emu/full.c -emu_full_mod_CFLAGS = $(COMMON_CFLAGS) -emu_full_mod_LDFLAGS = $(COMMON_LDFLAGS) - -noinst_MODULES = emu-lite.mod -emu_lite_mod_SOURCES = kern/emu/lite.c kern/emu/cache.S symlist.c -emu_lite_mod_CFLAGS = $(COMMON_CFLAGS) -emu_lite_mod_LDFLAGS = $(COMMON_LDFLAGS) - # For halt.mod. pkglib_MODULES += halt.mod halt_mod_SOURCES = commands/halt.c @@ -111,12 +101,28 @@ grub_emu_init.o: grub_emu_init.c grub_emu_init.h rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $< CLEANFILES += grub_emu_init.o +kern_emu_lite.o: kern/emu/lite.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/lite.c\" -c -o $@ $< +CLEANFILES += kern_emu_lite.o + +kern_emu_full.o: kern/emu/full.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/full.c\" -c -o $@ $< +CLEANFILES += kern_emu_full.o + +kern_emu_cache.o: kern/emu/cache.S + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_ASFLAGS) -DGRUB_FILE=\"kern/emu/cache.S\" -c -o $@ $< +CLEANFILES += kern_emu_cache.o + +symlist.o: symlist.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"symlist.c\" -c -o $@ $< +CLEANFILES += symlist.o + CLEANFILES += grub-emu-lite -grub-emu-lite: $(pkglib_PROGRAMS) emu-lite.mod +grub-emu-lite: kern_emu_lite.o kern_emu_cache.o symlist.o kernel.img $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) GRUB_EMU_LITE=grub-emu-lite CLEANFILES += grub-emu -grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS) emu-full.mod grub_emu_init.o +grub-emu: $(PREMODFILES) kern_emu_full.o grub_emu_init.o kernel.img $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) GRUB_EMU=grub-emu diff --git a/genmk.rb b/genmk.rb index 6b5ecd1d4..5d06d1153 100644 --- a/genmk.rb +++ b/genmk.rb @@ -161,6 +161,7 @@ endif #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str} +PREMODFILES += #{pre_obj} #{mod_obj}: #{mod_src} $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $<