imtk
annotate Makefile @ 23:4c2b3e281409
added a half-assed automatic layout thing
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sat, 28 May 2011 22:31:51 +0300 |
parents | 737e9047d9c9 |
children | bb358d8c4903 |
rev | line source |
---|---|
nuclear@20 | 1 src = $(wildcard src/*.c) |
nuclear@0 | 2 obj = $(src:.c=.o) |
nuclear@14 | 3 depfiles = $(obj:.o=.d) |
nuclear@20 | 4 lib_a = libimtk.a |
nuclear@0 | 5 bin = test |
nuclear@0 | 6 |
nuclear@20 | 7 PREFIX = /usr/local |
nuclear@20 | 8 |
nuclear@0 | 9 CC = gcc |
nuclear@20 | 10 AR = ar |
nuclear@0 | 11 CFLAGS = -pedantic -Wall -g -Isrc |
nuclear@18 | 12 LDFLAGS = $(libgl) -lm |
nuclear@0 | 13 |
nuclear@0 | 14 ifeq ($(shell uname -s), Darwin) |
nuclear@0 | 15 libgl = -framework OpenGL -framework GLUT |
nuclear@0 | 16 else |
nuclear@9 | 17 libgl = -lGL -lGLU -lglut |
nuclear@0 | 18 endif |
nuclear@0 | 19 |
nuclear@20 | 20 $(bin): $(lib_a) test.o |
nuclear@20 | 21 $(CC) -o $@ test.o $(lib_a) $(LDFLAGS) |
nuclear@20 | 22 |
nuclear@20 | 23 $(lib_a): $(obj) |
nuclear@20 | 24 $(AR) rcs $@ $(obj) |
nuclear@0 | 25 |
nuclear@14 | 26 -include $(depfiles) |
nuclear@14 | 27 |
nuclear@14 | 28 %.d: %.c |
nuclear@14 | 29 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ |
nuclear@14 | 30 |
nuclear@0 | 31 .PHONY: clean |
nuclear@0 | 32 clean: |
nuclear@20 | 33 rm -f $(obj) $(bin) $(lib_a) test.o |
nuclear@14 | 34 |
nuclear@14 | 35 .PHONY: cleandep |
nuclear@14 | 36 cleandep: |
nuclear@14 | 37 rm -f $(depfiles) |
nuclear@20 | 38 |
nuclear@20 | 39 .PHONY: install |
nuclear@20 | 40 install: $(lib_a) |
nuclear@20 | 41 mkdir -p $(PREFIX)/include $(PREFIX)/lib |
nuclear@20 | 42 cp $(lib_a) $(PREFIX)/lib/$(lib_a) |
nuclear@20 | 43 cp src/imtk.h $(PREFIX)/include/imtk.h |
nuclear@20 | 44 |
nuclear@20 | 45 .PHONY: uninstall |
nuclear@20 | 46 uninstall: |
nuclear@20 | 47 rm -f $(PREFIX)/lib/$(lib_a) |
nuclear@20 | 48 rm -f $(PREFIX)/include/imtk.h |