[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 02 of 10] xenalyze: automatically generate dependencies



On Thu, May 31, 2012 at 12:16 PM, David Vrabel <david.vrabel@xxxxxxxxxx> wrote:
> Use gcc's -MD and -MP options to automatically generate dependencies.
>
> Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

>
> diff --git a/.hgignore b/.hgignore
> --- a/.hgignore
> +++ b/.hgignore
> @@ -1,3 +1,4 @@
> +.*\.d
>  .*\.o
>  xenalyze
>  dump-raw
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -1,5 +1,3 @@
> -CC = gcc
> -
>  CFLAGS += -g -O2
>  CFLAGS += -fno-strict-aliasing
>  CFLAGS += -std=gnu99
> @@ -7,22 +5,35 @@ CFLAGS += -Wall -Wstrict-prototypes
>  CFLAGS += -Wno-unused-value
>  CFLAGS += -Wdeclaration-after-statement
>
> -CFLAGS  += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> +CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
>  CFLAGS += -mno-tls-direct-seg-refs
> -CFLAGS  += -Werror
> +CFLAGS += -Werror
>
> -BIN      = xenalyze dump-raw
> +BIN := xenalyze dump-raw
>
> -HDRS = trace.h analyze.h mread.h
> +xenalyze_OBJS := \
> +       mread.o \
> +       xenalyze.o
> +
> +dump-raw_OBJS := \
> +       dump-raw.o
>
>  all: $(BIN)
>
> +xenalyze: $(xenalyze_OBJS)
> +       $(CC) $(LDFLAGS) -o $@ $^
> +
> +dump-raw: $(dump-raw_OBJS)
> +       $(CC) $(LDFLAGS) -o $@ $^
> +
> +%.o: %.c
> +       $(CC) $(CFLAGS) -MD -MP -c -o $@ $<
> +
> +all_objs := $(foreach b,$(BIN),$($(b)_OBJS))
> +all_deps := $(all_objs:.o=.d)
> +
>  .PHONY: clean
>  clean:
> -       $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN)
> +       $(RM) $(BIN) $(all_objs) $(all_deps)
>
> -%: %.c $(HDRS) Makefile
> -       $(CC) $(CFLAGS) -o $@ $<
> -
> -xenalyze: xenalyze.o mread.o
> -       $(CC) $(CFLAGS) -o $@ $^
> +-include $(all_deps)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.