Skip to contentSkip to conversation

minios, stubdom: Add OBJ_DIR parameter to compile outside sources

PATCH New Samuel Thibault 1 participant 1 message Jun 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minios, stubdom: Add OBJ_DIR parameter to compile outside sources

minios,stubdom: Add OBJ_DIR parameter to compile outside sources, which permits to easily compile mini-os in various flavors. Also clean some parts of stubdom build.

.hgignore +1 -3
diff -r 0df3bf8aac1e .hgignore
@@ -90,12 +90,10 @@
 ^stubdom/ioemu$
 ^stubdom/libxc$
 ^stubdom/lwip-.*$
-^stubdom/mini-os$
+^stubdom/mini-os-.*$
 ^stubdom/newlib-.*$
 ^stubdom/pciutils-.*$
 ^stubdom/zlib-.*$
-^stubdom/c/main-c.c$
-^stubdom/caml/main-c.c$
 ^tools/.*/TAGS$
 ^tools/.*/build/lib.*/.*\.py$
 ^tools/blktap/Makefile\.smh$
extras/mini-os/Makefile +21 -20

98 lines not on this page · raw message

extras/mini-os/arch/ia64/Makefile +4 -3
diff -r 0df3bf8aac1e extras/mini-os/arch/ia64/Makefile
@@ -40,12 +40,13 @@
 ARCH_OBJS += __udivdi3.o
 ARCH_OBJS += __udivsi3.o
 ARCH_OBJS += __divdi3.o
+ARCH_OBJS := $(addprefix $(OBJ_DIR)/,$(ARCH_OBJS))
 
 GEN_OFF_SRC := gen_off.c
 GEN_OFF_ASM := gen_off.s
 GEN_OFF_H   := $(MINI-OS_ROOT)/include/$(ARCH_INC)/offsets.h
 
-all: $(ARCH_LIB)
+all: $(OBJ_DIR)/$(ARCH_LIB)
 
 $(GEN_OFF_ASM): $(GEN_OFF_SRC)
 	$(CC) -S -o $@ $(CPPFLAGS) $<
@@ -53,10 +54,10 @@
 $(GEN_OFF_H): $(GEN_OFF_ASM)
 	sed -ne "/^->/ {s/->/#define /; p}" < $< > $@
 
-$(ARCH_LIB): $(GEN_OFF_H) $(ARCH_OBJS) $(HEAD_ARCH_OBJ)
+$(OBJ_DIR)/$(ARCH_LIB): $(GEN_OFF_H) $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ)
 	$(AR) rv $(ARCH_LIB) $(ARCH_OBJS)
 
 clean:
-	rm -f $(ARCH_LIB) $(ARCH_OBJS) $(HEAD_ARCH_OBJ)
+	rm -f $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ)
 	rm -f $(GEN_OFF_ASM)
 	rm -f $(GEN_OFF_H)
extras/mini-os/arch/x86/Makefile +5 -5
diff -r 0df3bf8aac1e extras/mini-os/arch/x86/Makefile
@@ -17,15 +17,15 @@
 ARCH_SRCS := $(wildcard *.c)
 
 # The objects built from the sources.
-ARCH_OBJS := $(patsubst %.c,%.o,$(ARCH_SRCS))
+ARCH_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(ARCH_SRCS))
 
-all: $(ARCH_LIB)
+all: $(OBJ_DIR)/$(ARCH_LIB)
 
 # $(HEAD_ARCH_OBJ) is only build here, needed on linking
 # in ../../Makefile.
-$(ARCH_LIB): $(ARCH_OBJS) $(HEAD_ARCH_OBJ)
-	$(AR) rv $(ARCH_LIB) $(ARCH_OBJS)
+$(OBJ_DIR)/$(ARCH_LIB): $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ)
+	$(AR) rv $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS)
 
 clean:
-	rm -f $(ARCH_LIB) $(ARCH_OBJS) $(HEAD_ARCH_OBJ)
+	rm -f $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ)
 
extras/mini-os/main.c +4 -2
diff -r 0df3bf8aac1e extras/mini-os/main.c
@@ -4,6 +4,7 @@
  * Samuel Thibault <[email protected]>, October 2007
  */
 
+#ifdef HAVE_LIBC
 #include <os.h>
 #include <sched.h>
 #include <console.h>
@@ -112,7 +113,7 @@
 	} \
     }
 
-    PARSE_ARGS(start_info.cmd_line, argc++, );
+    PARSE_ARGS((char*)start_info.cmd_line, argc++, );
 #ifdef CONFIG_QEMU
     PARSE_ARGS(domargs, argc++, );
 #endif
@@ -121,7 +122,7 @@
     argv[0] = "main";
     argc = 1;
 
-    PARSE_ARGS(start_info.cmd_line, argv[argc++] = c, *c++ = 0)
+    PARSE_ARGS((char*)start_info.cmd_line, argv[argc++] = c, *c++ = 0)
 #ifdef CONFIG_QEMU
     PARSE_ARGS(domargs, argv[argc++] = c, *c++ = 0)
 #endif
@@ -168,3 +169,4 @@
     main_thread = create_thread("main", call_main, si);
     return 0;
 }
+#endif
extras/mini-os/minios.mk +3 -3
diff -r 0df3bf8aac1e extras/mini-os/minios.mk
@@ -57,13 +57,13 @@
 # This object contains the entrypoint for startup from Xen.
 # $(HEAD_ARCH_OBJ) has to be built in the architecture specific directory.
 HEAD_ARCH_OBJ := $(XEN_TARGET_ARCH).o
-HEAD_OBJ := $(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ)
+HEAD_OBJ := $(OBJ_DIR)/$(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ)
 
 
-%.o: %.c $(HDRS) Makefile $(EXTRA_DEPS)
+$(OBJ_DIR)/%.o: %.c $(HDRS) Makefile $(EXTRA_DEPS)
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
 
-%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS)
+$(OBJ_DIR)/%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS)
 	$(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@
 
 
stubdom/Makefile +37 -29

140 lines not on this page · raw message

stubdom/c/Makefile +1 -4
diff -r 0df3bf8aac1e stubdom/c/Makefile
@@ -4,10 +4,7 @@
 
 all: main.a
 
-main-c.c:
-	ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@
-
-main.a: main-c.o main.o 
+main.a: main.o 
 	$(AR) cr $@ $^
 
 clean:
stubdom/caml/Makefile +1 -4
diff -r 0df3bf8aac1e stubdom/caml/Makefile
@@ -11,10 +11,7 @@
 OBJS := hello.cmx
 LIBS := 
 
-all: main-c.o main-caml.o caml.o
-
-main-c.c:
-	ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@
+all: main-caml.o caml.o
 
 %.cmx: %.ml
 	$(OCAMLFIND) $(OCAMLOPT) -c $< -o $@
tools/ioemu/Makefile.target +0 -7
diff -r 0df3bf8aac1e tools/ioemu/Makefile.target
@@ -355,13 +355,6 @@
 endif
 ifdef CONFIG_WIN32
 VL_OBJS+=tap-win32.o
-endif
-
-ifdef CONFIG_STUBDOM
-VL_OBJS+=main-qemu.o
-CFLAGS += -DCONFIG_QEMU
-main-qemu.c:
-	ln -s $(XEN_ROOT)/extras/mini-os/main.c $@
 endif
 
 ifdef CONFIG_STUBDOM