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
15tt1 = liquidrescale
16tt2 = liquidrescale-basic
17# objects to build
18tt1obj = $(tt1).o
19tt2obj = $(tt2).o
20# executable names
21tt1out = liquidrescale
22tt2out = liquidrescale-basic
23
24
25# collect flags for the compiler for lqr library
26LQR_CFLAGS = `pkg-config --cflags lqr-1`
27
28LQR_LIBS = `pkg-config --libs lqr-1`
29
30LQR_LIBDIR = `pkg-config --variable=libdir lqr-1`
31
32# collect flags for pngwriter library
33PNGWRITER_CFLAGS = `freetype-config --cflags`
34
35PNGWRITER_LIBS = -lpng -lpngwriter -lz -lfreetype
36
37# collect flags for the compiler for glib thread support
38GTHREAD_LIBS = `pkg-config --libs gthread-2.0`
39
40# join the flags collected above
41INCLUDES = \
42	$(LQR_CFLAGS) \
43	$(PNGWRITER_CFLAGS)
44
45LIBDIRS = \
46	  -L$(LQR_LIBDIR)
47
48LIBS = \
49       $(LQR_LIBS) \
50       $(PNGWRITER_LIBS) \
51       $(GTHREAD_LIBS)
52
53# define the flags to use in the various compilation steps
54BASE_FLAGS = -Winline -O2 -Wall
55OBJ_BUILD_FLAGS = $(BASE_FLAGS) $(INCLUDES) $(LIBDIRS)
56LINKING_FLAGS = $(OBJ_BUILD_FLAGS) $(LIBS)
57
58# compilation rules
59
60.PHONY : all clean
61
62all: $(tt1out) $(tt2out)
63
64# linking
65$(tt1out) : $(tt1obj)
66	$(CXX) $(LINKING_FLAGS) -o $(tt1out) $(tt1obj)
67
68$(tt2out) : $(tt2obj)
69	$(CXX) $(LINKING_FLAGS) -o $(tt2out) $(tt2obj)
70
71# object building
72$(tt1).o : $(tt1).cpp $(tt1).h
73	$(CXX) -c $(OBJ_BUILD_FLAGS) $(tt1).cpp
74
75$(tt2).o : $(tt2).cpp
76	$(CXX) -c $(OBJ_BUILD_FLAGS) $(tt2).cpp
77
78#cleanup
79clean:
80	rm -f *~ ctags $(tt1obj) $(tt2obj) $(tt1out) $(tt2out)
81
82