# Similar Makefile than before for the synchronous glib-dbus-example, # but this time for two clients. client-stubs uses the generated stub # functions, client-glib uses the GLib wrapper functions. Comment # verbosity has also been reduced. # Interface XML name (used in multiple targets) interface_xml := value-dbus-interface.xml # Define a list of pkg-config packages we want to use pkg_packages := dbus-1 dbus-glib-1 # Get compilation flags for necessary libraries from pkg-config PKG_CFLAGS := $(shell pkg-config --cflags $(pkg_packages)) # Get linking flags PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages)) # Add debugging, full warnings and GLib deprecation ADD_CFLAGS += -g -Wall -DG_DISABLE_DEPRECATED # -DNO_DAEMON : do not daemonize the server (on a separate line so can # be disabled just by commenting the line) ADD_CFLAGS += -DNO_DAEMON # Combine user supplied, additional and pkg-config flags CFLAGS := $(PKG_CFLAGS) $(ADD_CFLAGS) $(CFLAGS) LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) # Define a list of generated files so that they can be cleaned as well cleanfiles := value-client-stub.h value-server-stub.h targets = server client-stubs client-glib .PHONY: all clean checkxml all: $(targets) server: server.o $(CC) $^ -o $@ $(LDFLAGS) client-stubs: client-stubs.o $(CC) $^ -o $@ $(LDFLAGS) client-glib: client-glib.o $(CC) $^ -o $@ $(LDFLAGS) server.o: server.c common-defs.h value-server-stub.h $(CC) $(CFLAGS) -DPROGNAME=\"$(basename $@)\" -c $< -o $@ client-stubs.o: client-stubs.c common-defs.h value-client-stub.h $(CC) $(CFLAGS) -DPROGNAME=\"$(basename $@)\" -c $< -o $@ # Note that the GLib client doesn't need the stub code. client-glib.o: client-glib.c common-defs.h $(CC) $(CFLAGS) -DPROGNAME=\"$(basename $@)\" -c $< -o $@ # The stub header dependencies value-server-stub.h: $(interface_xml) dbus-binding-tool --prefix=value_object --mode=glib-server \ $< > $@ value-client-stub.h: $(interface_xml) dbus-binding-tool --prefix=value_object --mode=glib-client \ $< > $@ # XML interface validation checkxml: $(interface_xml) @xmllint --valid --noout $< @echo $< checks out ok clean: $(RM) $(targets) $(cleanfiles) *.o # Changing Makefile will cause rebuild server.o client-stubs.o clients-glib.o: Makefile