imtk

diff Makefile @ 20:c7a7ddbe7714

half-arsed automatic layout
author John Tsiombikas <nuclear@siggraph.org>
date Sat, 30 Apr 2011 05:23:59 +0300
parents 737e9047d9c9
children bb358d8c4903
line diff
     1.1 --- a/Makefile	Tue Apr 26 22:53:21 2011 +0300
     1.2 +++ b/Makefile	Sat Apr 30 05:23:59 2011 +0300
     1.3 @@ -1,9 +1,13 @@
     1.4 -src = $(wildcard *.c src/*.c)
     1.5 +src = $(wildcard src/*.c)
     1.6  obj = $(src:.c=.o)
     1.7  depfiles = $(obj:.o=.d)
     1.8 +lib_a = libimtk.a
     1.9  bin = test
    1.10  
    1.11 +PREFIX = /usr/local
    1.12 +
    1.13  CC = gcc
    1.14 +AR = ar
    1.15  CFLAGS = -pedantic -Wall -g -Isrc
    1.16  LDFLAGS = $(libgl) -lm
    1.17  
    1.18 @@ -13,8 +17,11 @@
    1.19  	libgl = -lGL -lGLU -lglut
    1.20  endif
    1.21  
    1.22 -$(bin): $(obj)
    1.23 -	$(CC) -o $@ $(obj) $(LDFLAGS)
    1.24 +$(bin): $(lib_a) test.o
    1.25 +	$(CC) -o $@ test.o $(lib_a) $(LDFLAGS)
    1.26 +
    1.27 +$(lib_a): $(obj)
    1.28 +	$(AR) rcs $@ $(obj)
    1.29  
    1.30  -include $(depfiles)
    1.31  
    1.32 @@ -23,8 +30,19 @@
    1.33  
    1.34  .PHONY: clean
    1.35  clean:
    1.36 -	rm -f $(obj) $(bin)
    1.37 +	rm -f $(obj) $(bin) $(lib_a) test.o
    1.38  
    1.39  .PHONY: cleandep
    1.40  cleandep:
    1.41  	rm -f $(depfiles)
    1.42 +
    1.43 +.PHONY: install
    1.44 +install: $(lib_a)
    1.45 +	mkdir -p $(PREFIX)/include $(PREFIX)/lib
    1.46 +	cp $(lib_a) $(PREFIX)/lib/$(lib_a)
    1.47 +	cp src/imtk.h $(PREFIX)/include/imtk.h
    1.48 +
    1.49 +.PHONY: uninstall
    1.50 +uninstall:
    1.51 +	rm -f $(PREFIX)/lib/$(lib_a)
    1.52 +	rm -f $(PREFIX)/include/imtk.h