From f26e6e803a15c480d863d6f23ec8143f6a619e75 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 28 Aug 2011 12:33:46 +0200 Subject: [PATCH] The Sortix programs are now compiled into initrd/. --- Makefile | 5 ----- hello/Makefile | 23 +++++++++++++++++------ initrd/.gitignore | 2 ++ pong/Makefile | 23 +++++++++++++++++------ utils/.gitignore | 1 + utils/Makefile | 15 +++++++++++---- 6 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 initrd/.gitignore create mode 100644 utils/.gitignore diff --git a/Makefile b/Makefile index e8d71036..deb60c97 100644 --- a/Makefile +++ b/Makefile @@ -100,12 +100,7 @@ iso: all debsource mkdir -p $(ISODIR) cp -r isosrc/. $(ISODIR) cp sortix/sortix.bin $(ISODIR)/boot - mkdir -p $(INITRDDIR) - cp hello/hello $(INITRDDIR) - cp pong/pong $(INITRDDIR) - for F in init cat sh mxsh clear ls help uname; do cp utils/$$F $(INITRDDIR); done (cd $(INITRDDIR) && ../mkinitrd/mkinitrd * -o ../$(ISODIR)/boot/sortix.initrd) - rm -rf $(INITRDDIR) cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR) grub-mkrescue -o $(ISOFILE) $(ISODIR) rm -rf $(ISODIR) diff --git a/hello/Makefile b/hello/Makefile index af3e9291..f72b6053 100644 --- a/hello/Makefile +++ b/hello/Makefile @@ -2,14 +2,25 @@ OSROOT=.. include ../crosscompilemakefile.mak -all: hello +INITRDDIR:=../initrd +LOCALBINARIES:=\ +hello \ -hello: hello.o - $(LD) $(LDFLAGS) hello.o -o hello $(LIBS) +BINARIES:=$(addprefix $(INITRDDIR)/,$(BINARIES)) -hello.o: hello.cpp - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c hello.cpp -o hello.o +all: install + +install: $(LOCALBINARIES) + cp $(LOCALBINARIES) $(INITRDDIR) + rm -f $(LOCALBINARIES) + +%: %.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@.o + $(LD) $(LDFLAGS) $@.o -o $@ $(LIBS) + +sh: mxsh + cp $< $@ clean: - rm -f hello.o hello + rm -f $(BINARIES) $(LOCALBINARIES) *.o diff --git a/initrd/.gitignore b/initrd/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/initrd/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/pong/Makefile b/pong/Makefile index a26f7a59..cb5115c9 100644 --- a/pong/Makefile +++ b/pong/Makefile @@ -2,14 +2,25 @@ OSROOT=.. include ../crosscompilemakefile.mak -all: pong +INITRDDIR:=../initrd +LOCALBINARIES:=\ +pong \ -pong: pong.o - $(LD) $(LDFLAGS) pong.o -o pong $(LIBS) +BINARIES:=$(addprefix $(INITRDDIR)/,$(BINARIES)) -pong.o: pong.cpp - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c pong.cpp -o pong.o +all: install + +install: $(LOCALBINARIES) + cp $(LOCALBINARIES) $(INITRDDIR) + rm -f $(LOCALBINARIES) + +%: %.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@.o + $(LD) $(LDFLAGS) $@.o -o $@ $(LIBS) + +sh: mxsh + cp $< $@ clean: - rm -f pong.o pong + rm -f $(BINARIES) $(LOCALBINARIES) *.o diff --git a/utils/.gitignore b/utils/.gitignore new file mode 100644 index 00000000..5761abcf --- /dev/null +++ b/utils/.gitignore @@ -0,0 +1 @@ +*.o diff --git a/utils/Makefile b/utils/Makefile index b8018cdf..b3cd8e3f 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -2,7 +2,8 @@ OSROOT=.. include ../crosscompilemakefile.mak -BINARIES:=\ +INITRDDIR:=../initrd +LOCALBINARIES:=\ init \ cat \ sh \ @@ -12,15 +13,21 @@ ls \ help \ uname \ -all: $(BINARIES) +BINARIES:=$(addprefix $(INITRDDIR)/,$(BINARIES)) + +all: install + +install: $(LOCALBINARIES) + cp $(LOCALBINARIES) $(INITRDDIR) + rm -f $(LOCALBINARIES) %: %.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@.o $(LD) $(LDFLAGS) $@.o -o $@ $(LIBS) sh: mxsh - cp mxsh sh + cp $< $@ clean: - rm -f $(BINARIES) *.o + rm -f $(BINARIES) $(LOCALBINARIES) *.o