| 1 |
# |
| 2 |
# Makefile example for liquidrescale (lqr) library |
| 3 |
# |
| 4 |
# This is thought for exemplification purposes. |
| 5 |
# It will only work if you have already installed |
| 6 |
# the lqr library, the pngwriter and all their |
| 7 |
# required dependencies (glib, z, png, freetype). |
| 8 |
# |
| 9 |
# It does not perform any kind of check on the system, |
| 10 |
# and won't report any sensible error message. |
| 11 |
# |
| 12 |
|
| 13 |
|
| 14 |
# set the sources file name |
| 15 |
tt1 = liquidrescale |
| 16 |
tt2 = liquidrescale-basic |
| 17 |
# objects to build |
| 18 |
tt1obj = $(tt1).o |
| 19 |
tt2obj = $(tt2).o |
| 20 |
# executable names |
| 21 |
tt1out = liquidrescale |
| 22 |
tt2out = liquidrescale-basic |
| 23 |
|
| 24 |
|
| 25 |
# collect flags for the compiler for lqr library |
| 26 |
LQR_CFLAGS = `pkg-config --cflags lqr-1` |
| 27 |
|
| 28 |
LQR_LIBS = `pkg-config --libs lqr-1` |
| 29 |
|
| 30 |
LQR_LIBDIR = `pkg-config --variable=libdir lqr-1` |
| 31 |
|
| 32 |
# collect flags for pngwriter library |
| 33 |
PNGWRITER_CFLAGS = `freetype-config --cflags` |
| 34 |
|
| 35 |
PNGWRITER_LIBS = -lpng -lpngwriter -lz -lfreetype |
| 36 |
|
| 37 |
# collect flags for the compiler for glib thread support |
| 38 |
GTHREAD_LIBS = `pkg-config --libs gthread-2.0` |
| 39 |
|
| 40 |
# join the flags collected above |
| 41 |
INCLUDES = \ |
| 42 |
$(LQR_CFLAGS) \ |
| 43 |
$(PNGWRITER_CFLAGS) |
| 44 |
|
| 45 |
LIBDIRS = \ |
| 46 |
-L$(LQR_LIBDIR) |
| 47 |
|
| 48 |
LIBS = \ |
| 49 |
$(LQR_LIBS) \ |
| 50 |
$(PNGWRITER_LIBS) \ |
| 51 |
$(GTHREAD_LIBS) |
| 52 |
|
| 53 |
# define the flags to use in the various compilation steps |
| 54 |
BASE_FLAGS = -Winline -O2 -Wall |
| 55 |
OBJ_BUILD_FLAGS = $(BASE_FLAGS) $(INCLUDES) $(LIBDIRS) |
| 56 |
LINKING_FLAGS = $(OBJ_BUILD_FLAGS) $(LIBS) |
| 57 |
|
| 58 |
# compilation rules |
| 59 |
|
| 60 |
.PHONY : all clean |
| 61 |
|
| 62 |
all: $(tt1out) $(tt2out) |
| 63 |
|
| 64 |
# linking |
| 65 |
$(tt1out) : $(tt1obj) |
| 66 |
g++ $(LINKING_FLAGS) -o $(tt1out) $(tt1obj) |
| 67 |
|
| 68 |
$(tt2out) : $(tt2obj) |
| 69 |
g++ $(LINKING_FLAGS) -o $(tt2out) $(tt2obj) |
| 70 |
|
| 71 |
# object building |
| 72 |
$(tt1).o : $(tt1).cpp $(tt1).h |
| 73 |
g++ -c $(OBJ_BUILD_FLAGS) $(tt1).cpp |
| 74 |
|
| 75 |
$(tt2).o : $(tt2).cpp |
| 76 |
g++ -c $(OBJ_BUILD_FLAGS) $(tt2).cpp |
| 77 |
|
| 78 |
#cleanup |
| 79 |
clean: |
| 80 |
rm -f *~ ctags $(tt1obj) $(tt2obj) $(tt1out) $(tt2out) |
| 81 |
|