imtk

view Makefile @ 25:bb358d8c4903

added $(PREFIX)/include and $(PREFIX)/lib into the paths
author John Tsiombikas <nuclear@mutantstargoat.com>
date Tue, 04 Oct 2011 19:24:51 +0300
parents c7a7ddbe7714
children
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 depfiles = $(obj:.o=.d)
4 lib_a = libimtk.a
5 bin = test
7 PREFIX = /usr/local
9 CC = gcc
10 AR = ar
11 CFLAGS = -pedantic -Wall -g -Isrc -I$(PREFIX)/include
12 LDFLAGS = -L$(PREFIX)/lib $(libgl) -lm
14 ifeq ($(shell uname -s), Darwin)
15 libgl = -framework OpenGL -framework GLUT
16 else
17 libgl = -lGL -lGLU -lglut
18 endif
20 $(bin): $(lib_a) test.o
21 $(CC) -o $@ test.o $(lib_a) $(LDFLAGS)
23 $(lib_a): $(obj)
24 $(AR) rcs $@ $(obj)
26 -include $(depfiles)
28 %.d: %.c
29 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
31 .PHONY: clean
32 clean:
33 rm -f $(obj) $(bin) $(lib_a) test.o
35 .PHONY: cleandep
36 cleandep:
37 rm -f $(depfiles)
39 .PHONY: install
40 install: $(lib_a)
41 mkdir -p $(PREFIX)/include $(PREFIX)/lib
42 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
43 cp src/imtk.h $(PREFIX)/include/imtk.h
45 .PHONY: uninstall
46 uninstall:
47 rm -f $(PREFIX)/lib/$(lib_a)
48 rm -f $(PREFIX)/include/imtk.h