# define a list of pkg-config packages we want to use pkg_packages := gtk+-2.0 hildon-1 # get the necessary flags for compiling PKG_CFLAGS := $(shell pkg-config --cflags $(pkg_packages)) # get the necessary flags for linking PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages)) # additional flags # -Wall: warnings # -g: debugging ADD_CFLAGS := -Wall -g # combine the flags (so that CFLAGS/LDFLAGS from the command line # still work). CFLAGS := $(PKG_CFLAGS) $(ADD_CFLAGS) $(CFLAGS) LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) targets = hildon_helloworld-1 .PHONY: all all: $(targets) hildon_helloworld-1: hildon_helloworld-1.o $(CC) $^ -o $@ $(LDFLAGS) hildon_helloworld-1.o: hildon_helloworld-1.c $(CC) $(CFLAGS) -c $< -o $@ .PHONY: clean clean: $(RM) $(targets) *.o