dsys2
annotate Makefile @ 11:65da828bc218
forgot the dependecy to lib_a for the install target
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sun, 04 Sep 2011 18:21:26 +0300 |
parents | 5ba9dd6742a0 |
children | 6bab2c0b0e4b |
rev | line source |
---|---|
nuclear@10 | 1 PREFIX = /usr/local |
nuclear@10 | 2 |
nuclear@0 | 3 src = $(wildcard src/*.c) |
nuclear@0 | 4 obj = $(src:.c=.o) |
nuclear@0 | 5 dep = $(obj:.o=.d) |
nuclear@0 | 6 |
nuclear@0 | 7 lib_a = libdsys2.a |
nuclear@0 | 8 |
nuclear@0 | 9 CC = gcc |
nuclear@0 | 10 AR = ar |
nuclear@2 | 11 CFLAGS = -pedantic -Wall -g -Isrc |
nuclear@2 | 12 |
nuclear@5 | 13 ifeq ($(shell uname -s), Darwin) |
nuclear@5 | 14 libgl = -framework OpenGL -framework GLUT |
nuclear@5 | 15 else |
nuclear@5 | 16 libgl = -lGL -lGLU -lglut |
nuclear@5 | 17 endif |
nuclear@5 | 18 |
nuclear@2 | 19 test: test.o $(lib_a) |
nuclear@5 | 20 $(CC) $(CFLAGS) -o $@ test.o $(lib_a) $(libgl) -lm |
nuclear@0 | 21 |
nuclear@0 | 22 $(lib_a): $(obj) |
nuclear@0 | 23 $(AR) rcs $@ $(obj) |
nuclear@0 | 24 |
nuclear@0 | 25 -include $(dep) |
nuclear@0 | 26 |
nuclear@0 | 27 %.d: %.c |
nuclear@0 | 28 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ |
nuclear@0 | 29 |
nuclear@0 | 30 .PHONY: clean |
nuclear@0 | 31 clean: |
nuclear@0 | 32 rm -f $(obj) $(bin) |
nuclear@0 | 33 |
nuclear@0 | 34 .PHONY: cleandep |
nuclear@0 | 35 cleandep: |
nuclear@0 | 36 rm -f $(dep) |
nuclear@10 | 37 |
nuclear@10 | 38 .PHONY: install |
nuclear@11 | 39 install: $(lib_a) |
nuclear@10 | 40 mkdir -p $(PREFIX)/include $(PREFIX)/lib |
nuclear@10 | 41 cp $(lib_a) $(PREFIX)/lib/$(lib_a) |
nuclear@10 | 42 cp src/dsys2.h $(PREFIX)/include/dsys2.h |
nuclear@10 | 43 |
nuclear@10 | 44 .PHONY: uninstall |
nuclear@10 | 45 uninstall: |
nuclear@10 | 46 rm -f $(PREFIX)/include/dsys2.h $(PREFIX)/lib/$(lib_a) |