Makefile: fix fasm,nasm dependency handling

git-svn-id: svn://kolibrios.org@1820 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2011-01-31 11:22:30 +00:00
parent b96f90fcb5
commit 01484d760c
4 changed files with 22 additions and 16 deletions

View File

@ -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

View File

@ -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 "$$@" $$<

View File

@ -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

View File

@ -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 "$$@" $$<