Skip to content

Instantly share code, notes, and snippets.

@iwadon
Created April 16, 2011 09:08
Show Gist options
  • Select an option

  • Save iwadon/922998 to your computer and use it in GitHub Desktop.

Select an option

Save iwadon/922998 to your computer and use it in GitHub Desktop.
srcdir = .
builddir = .
cc = gcc
cflags = -Wall -Wextra -O2 -g
cppflags =
rule cc
depfile = $out.d
command = $cc -MMD -MF $out.d $cflags $cppflags-c $in -o $out
build $builddir/hello.o: cc $srcdir/hello.c
build all: phony || $builddir/hello.o
% ninja all
[1/1] gcc -MMD -MF ./hello.o.d -Wall -Wextra -O2 -g -c ./hello.c -o ./hello.o
% ninja all
ninja: error: expected makefile to mention './hello.o', got 'hello.o'
[1] 16941 exit 1 ninja all
#include <stdio.h>
int main()
{
printf("Hello.\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment