Skip to contentSkip to conversation

stubdom: add C example target

PATCH New Samuel Thibault 1 participant 1 message Mar 19, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stubdom: add C example target

stubdom: add C example target

extras/mini-os/Makefile +6 -1
diff -r 7d8892a90c90 extras/mini-os/Makefile
@@ -88,6 +88,11 @@
 CFLAGS += -DCONFIG_QEMU
 endif
 
+ifneq ($(CDIR),)
+OBJS += $(CDIR)/main.a
+LDLIBS += 
+endif
+
 ifeq ($(libc),y)
 LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest
 LDLIBS += -lpci
@@ -95,7 +100,7 @@
 LDLIBS += -lc
 endif
 
-ifneq ($(caml)-$(qemu)-$(lwip),--y)
+ifneq ($(caml)-$(qemu)-$(CDIR)-$(lwip),---y)
 OBJS := $(filter-out daytime.o, $(OBJS))
 endif
 
stubdom/Makefile +13 -1
@@ -201,6 +201,14 @@
 caml:
 	$(MAKE) -C $@
 
+###
+# C
+###
+
+.PHONY: c
+c:
+	$(MAKE) -C $@
+
 ########
 # minios
 ########
@@ -211,7 +219,11 @@
 
 .PHONY: caml-stubdom
 caml-stubdom: mk-symlinks lwip-cvs libxc cross-libpci caml
-	$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwia-cvs CAMLDIR=$(CURDIR)/caml
+	$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CAMLDIR=$(CURDIR)/caml
+
+.PHONY: c-stubdom
+c-stubdom: mk-symlinks lwip-cvs libxc cross-libpci c
+	$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CDIR=$(CURDIR)/c
 
 #########
 # install
stubdom/c/Makefile new file +9 -0
@@ -0,0 +1,9 @@
+XEN_ROOT = ../..
+
+include $(XEN_ROOT)/Config.mk
+
+main.a: main.o
+	$(AR) cr $@ $^
+
+clean:
+	rm -f *.a *.o
stubdom/c/main.c new file +6 -0
@@ -0,0 +1,6 @@
+#include <stdio.h>
+int main(void) {
+        sleep(2);
+        printf("Hello, world!\n");
+        return 0;
+}