X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=kitten%2Fuser%2FMake.rules;fp=kitten%2Fuser%2FMake.rules;h=3f31036ac668ccf363c41b0643289e368839d55d;hb=66a1a4c7a9edcd7d8bc207aca093d694a6e6b5b2;hp=0000000000000000000000000000000000000000;hpb=f7cf9c19ecb0a589dd45ae0d2c91814bd3c2acc2;p=palacios.git diff --git a/kitten/user/Make.rules b/kitten/user/Make.rules new file mode 100644 index 0000000..3f31036 --- /dev/null +++ b/kitten/user/Make.rules @@ -0,0 +1,55 @@ +# Copyright (c) 2008, Sandia National Laboratories + +# +# The build rules are modelled on the Linux style less-verbose +# build by default, but with full details if V=1 flag is +# set in the environment or on the build line. +# +# Typical usage: +# $(call build,FOO,$filename,\ +# foo -flags $filename \ +# ) +# +build = \ + @if [ "$(V)" != 1 ]; then \ + echo ' $1'; \ + else \ + echo "$2"; \ + fi; \ + $2 + +# +# Generate a library .a file from a list of object files. +# For consistency of symbol ordering, we do not use ar to do any +# updates of the library, but instead remove the old one and +# re-generate it from all of its input object files. +# +# Typical usage: +# $(call buildlib,libfoo.a,$(FILES)) +# +buildlib = \ + $(call build,AR $1,\ + $(RM) $1; \ + $(AR) crs $1 $2; \ + ) + +buildprog = \ + $(call build,LD $1,\ + $(RM) $1; \ + $(CC) -static -o $1 $2; \ + ) + +# +# Build the .o files from the sources. +# +%.o: %.c + $(call build,CC $@,$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<) + +all: $(PROGS-y) $(LIBS-y) + +clean: FORCE + $(call build,CLEAN $(PROGS-y) $(LIBS-y) $(OBJS-y), \ + $(RM) $(PROGS-y) $(LIBS-y) $(OBJS-y); \ + ) + +FORCE: