From 01484d760c03f44d0216786fd916fe66272720ca Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Mon, 31 Jan 2011 11:22:30 +0000 Subject: [PATCH] Makefile: fix fasm,nasm dependency handling git-svn-id: svn://kolibrios.org@1820 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/eng/Makefile.fasm | 12 ++++++------ data/eng/Makefile.nasm | 7 +++++-- data/rus/Makefile.fasm | 12 ++++++------ data/rus/Makefile.nasm | 7 +++++-- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/data/eng/Makefile.fasm b/data/eng/Makefile.fasm index ee7433459c..9fab3ed7b1 100644 --- a/data/eng/Makefile.fasm +++ b/data/eng/Makefile.fasm @@ -30,9 +30,9 @@ define fasm_meta_rule $(1): $(2) Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) fasm -m 65536 $$< "$$@" -s .deps/$(4).fas prepsrc .deps/$(4).fas /dev/null - prepsrc .deps/$(4).fas /dev/stdout | (echo -n '$(1):' && \ - perl -ne 's|\\|/|g;print " \\\n $$$$1" if /^;include \x27(.*?)\x27/' \ - && echo) > .deps/$(4).Po + prepsrc .deps/$(4).fas /dev/stdout | \ + perl -n -e 's|\\|/|g;push @a,$$$$1 if/^;include \x27(.*?)\x27/;' \ + -e 'END{$$$$a=join " \\\n ",@a;print "$(1): $$$$a\n$$$$a:\n"}' > .deps/$(4).Po kpack --nologo "$$@" -include .deps/$(4).Po endef @@ -45,8 +45,8 @@ $(foreach f,$(FASM_PROGRAMS),$(eval $(call fasm_meta_rule,$(fbinary),$(fsource), kernel.mnt: $(KERNEL)/kernel.asm Makefile.fasm .deps/.dir fasm -m 65536 $< "$@" -s .deps/kernel.fas prepsrc .deps/kernel.fas /dev/null - prepsrc .deps/kernel.fas /dev/stdout | (echo -n 'kernel.mnt:' && \ - perl -ne 's|\\|/|g;print " \\\n $$1" if /^;include \x27(.*?)\x27/' \ - && echo) > .deps/kernel.Po + prepsrc .deps/kernel.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;push @a,$$1 if/^;include \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/kernel.Po kerpack $@ -include .deps/kernel.Po diff --git a/data/eng/Makefile.nasm b/data/eng/Makefile.nasm index 18066de385..cb4714fd21 100644 --- a/data/eng/Makefile.nasm +++ b/data/eng/Makefile.nasm @@ -1,8 +1,11 @@ # This is similar to Makefile.fasm, look there for comments. define nasm_meta_rule .deps/$(4).Po: $(2) Makefile.nasm .deps/.dir - nasm -I$$(dir $(2)) -o "$(1)" -M $$< > .deps/$(4).Tpo 2>/dev/null; if [ $$$$? -eq 0 ]; \ - then sed 's|\(.*\):|\1 .deps/$(4).Po:|' .deps/$(4).Tpo > .deps/$(4).Po; fi + nasm -I$$(dir $(2)) -o "$(1)" -M $$< > .deps/$(4).Tpo 2>/dev/null; \ + if [ $$$$? -eq 0 ]; then perl -ln -e 'next unless $$$$_;' \ + -e 'm/((.*): )?(.*)/;$$$$a=$$$$2 if $$$$2;push @b,$$$$3;' \ + -e 'END{$$$$b=join "\n",@b;print "$$$$a .deps/$(4).Po: $$$$b\n$$$$b:"}' \ + .deps/$(4).Tpo > .deps/$(4).Po; fi rm -f .deps/$(4).Tpo $(1): $(2) Makefile.nasm $$(call respace,$$(addsuffix .dir,$(3))) nasm -I$$(dir $(2)) -o "$$@" $$< diff --git a/data/rus/Makefile.fasm b/data/rus/Makefile.fasm index ee7433459c..9fab3ed7b1 100644 --- a/data/rus/Makefile.fasm +++ b/data/rus/Makefile.fasm @@ -30,9 +30,9 @@ define fasm_meta_rule $(1): $(2) Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) fasm -m 65536 $$< "$$@" -s .deps/$(4).fas prepsrc .deps/$(4).fas /dev/null - prepsrc .deps/$(4).fas /dev/stdout | (echo -n '$(1):' && \ - perl -ne 's|\\|/|g;print " \\\n $$$$1" if /^;include \x27(.*?)\x27/' \ - && echo) > .deps/$(4).Po + prepsrc .deps/$(4).fas /dev/stdout | \ + perl -n -e 's|\\|/|g;push @a,$$$$1 if/^;include \x27(.*?)\x27/;' \ + -e 'END{$$$$a=join " \\\n ",@a;print "$(1): $$$$a\n$$$$a:\n"}' > .deps/$(4).Po kpack --nologo "$$@" -include .deps/$(4).Po endef @@ -45,8 +45,8 @@ $(foreach f,$(FASM_PROGRAMS),$(eval $(call fasm_meta_rule,$(fbinary),$(fsource), kernel.mnt: $(KERNEL)/kernel.asm Makefile.fasm .deps/.dir fasm -m 65536 $< "$@" -s .deps/kernel.fas prepsrc .deps/kernel.fas /dev/null - prepsrc .deps/kernel.fas /dev/stdout | (echo -n 'kernel.mnt:' && \ - perl -ne 's|\\|/|g;print " \\\n $$1" if /^;include \x27(.*?)\x27/' \ - && echo) > .deps/kernel.Po + prepsrc .deps/kernel.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;push @a,$$1 if/^;include \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/kernel.Po kerpack $@ -include .deps/kernel.Po diff --git a/data/rus/Makefile.nasm b/data/rus/Makefile.nasm index 18066de385..cb4714fd21 100644 --- a/data/rus/Makefile.nasm +++ b/data/rus/Makefile.nasm @@ -1,8 +1,11 @@ # This is similar to Makefile.fasm, look there for comments. define nasm_meta_rule .deps/$(4).Po: $(2) Makefile.nasm .deps/.dir - nasm -I$$(dir $(2)) -o "$(1)" -M $$< > .deps/$(4).Tpo 2>/dev/null; if [ $$$$? -eq 0 ]; \ - then sed 's|\(.*\):|\1 .deps/$(4).Po:|' .deps/$(4).Tpo > .deps/$(4).Po; fi + nasm -I$$(dir $(2)) -o "$(1)" -M $$< > .deps/$(4).Tpo 2>/dev/null; \ + if [ $$$$? -eq 0 ]; then perl -ln -e 'next unless $$$$_;' \ + -e 'm/((.*): )?(.*)/;$$$$a=$$$$2 if $$$$2;push @b,$$$$3;' \ + -e 'END{$$$$b=join "\n",@b;print "$$$$a .deps/$(4).Po: $$$$b\n$$$$b:"}' \ + .deps/$(4).Tpo > .deps/$(4).Po; fi rm -f .deps/$(4).Tpo $(1): $(2) Makefile.nasm $$(call respace,$$(addsuffix .dir,$(3))) nasm -I$$(dir $(2)) -o "$$@" $$<