Source

Hard real-time queues / Makefile

Full commit
# Copyright (c) 2012 Michele Bini

# This program is free software: you can redistribute it and/or modify
# it under the terms of the version 3 of the GNU General Public License
# as published by the Free Software Foundation.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


ALL=test
all: $(ALL)

BAEMHI=build-an-executable-mythryl-heap-image
MYTHRYLD=mythryld

test: tempclean
	${BAEMHI} test.lib test::main

dotlib:
	@ echo Creating .lib files
	make `printf "%s\n" *.pkg|sed "s/.pkg/.lib/"`

%.lib: %.pkg
	@ [ -e "$@"~ ] && mv "$@" "$@"~; (echo "# This file was automatically generated by 'make dotlib'." && echo && echo LIBRARY_EXPORTS && echo && sed -n "s/^generic package \\([a-z0-9_']*\\).*/	generic \\1/p" <"$<" && sed -n "s/^package \\([a-z0-9_']*\\).*/	pkg \\1/p" <"$<" && echo && echo LIBRARY_COMPONENTS && echo && (sed -n "s/.*#  *Requires:  *\\([^ ]*\\)/\\1/p"|sed "s,standard,""$$""ROOT/src/lib/std/standard.lib,"|sed "s/^/	/") <"$<" && echo && echo "	""$<" && echo) >"$@".new
	@ mv "$@".new "$@"
	@ echo Built "$@"

%.lib.compiled: %.lib
	@ ${MYTHRYLD} -e "exit(make(\"$<\") ?? 0 :: 1)"

%: %.lib %.pkg
	${MAKE} tempclean
	${BAEMHI} $< main::main

tempclean:
	rm -rf .tmp-* tmp-* *.compile.log

clean: tempclean
	rm -f $(ALL) *.compiled