# # Compiler settings # CC = gcc CFLAGS = -Wall -ansi -funroll-loops LIBS = -lm # # Compiler options for packages # CAIRO = $(shell pkg-config cairo --libs --cflags) GTK2 = $(shell pkg-config gtk+-2.0 --libs --cflags) GTK3 = $(shell pkg-config gtk+-3.0 --libs --cflags) GTKGL = $(shell pkg-config gtk+-2.0 gtkglext-1.0 --libs --cflags) GLUT = -lglut -lGL # # Cairo test programs # PROGRAMS_CAIRO = \ cairo1_drawing \ cairo2_transformation \ cairo3_recursion # # GTK test programs working with versions 2.x and 3.x # PROGRAMS_GTK = \ gtk1_button \ gtk2_hbox \ gtk3_packing \ gtk4_data \ gtk5_menu # # GTK test programs working only with version 2.x # PROGRAMS_GTK2 = \ gtk6_cairo \ gtk7_animation # # GTK test programs working only with version 3.x # PROGRAMS_GTK3 = \ gtk6b_cairo \ gtk7b_animation # # GLUT test programs # PROGRAMS_GLUT = \ glut1_window \ glut2_perspective \ glut3_rotate \ glut4_lighting \ glut5_cylinder # # GTKGL test programs # PROGRAMS_GTKGL = \ gtkgl1_window \ gtkgl2_perspective \ gtkgl3_rotate \ gtkgl4_lighting \ gtkgl5_cylinder # # Build targets # all: $(PROGRAMS_CAIRO) $(PROGRAMS_GTK) $(PROGRAMS_GTK2) $(PROGRAMS_GTK3) $(PROGRAMS_GTKGL) $(PROGRAMS_GLUT) cairo: $(PROGRAMS_CAIRO) gtk2: $(PROGRAMS_GTK) $(PROGRAMS_GTK2) gtk3: $(PROGRAMS_GTK3) gtkgl: $(PROGRAMS_GTKGL) glut: $(PROGRAMS_GLUT) all: $(PROGRAMS_CAIRO) $(PROGRAMS_GTK) $(PROGRAMS_GTK2) clean: rm -f $(PROGRAMS_CAIRO) $(PROGRAMS_GTK) $(PROGRAMS_GTK2) $(PROGRAMS_GTK3) $(PROGRAMS_GTKGL) $(PROGRAMS_GLUT) # # Build rule for Cairo programs # $(PROGRAMS_CAIRO): %: %.c $(CC) $(CFLAGS) $< $(LIBS) $(CAIRO) -o $@ # # Build rule for GTK+ 2.x programs # $(PROGRAMS_GTK) $(PROGRAMS_GTK2): %: %.c $(CC) $(CFLAGS) $< $(LIBS) $(GTK2) -o $@ # # Build rule for GTK+ 3.x programs # $(PROGRAMS_GTK3): %: %.c $(CC) $(CFLAGS) $< $(LIBS) $(GTK3) -o $@ # # Build rule for GTKGL programs # $(PROGRAMS_GTKGL): %: %.c $(CC) $(CFLAGS) $< $(LIBS) $(GTKGL) -o $@ # # Build rule for GLUT programs # $(PROGRAMS_GLUT): %: %.c $(CC) $(CFLAGS) $< $(LIBS) $(GLUT) -o $@