| January 18, 2011 | Making Sense of 'make' | Back Next |
[6exercise]
hello.c
#include <stdio.h>
main()
{ printf("Hello world\n"); }
Makefile (excerpt)
CC = gcc
CFLAGS = -g
all: hello
hello: hello.o
$(CC) $(LDFLAGS) -o $@ $^
hello.o: hello.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f hello hello.o
.PHONY: clean
| Home Last TOC | Copyright © 2011 James E Keenan | Back Next |