# # Copyright (C) 2015 David Härdeman # # # Generic settings # CC = gcc GENERIC_CFLAGS = -g -Wall -Werror -D_FILE_OFFSET_BITS=64 \ -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -flto EXTRA_CFLAGS = GENERIC_LDFLAGS = EXTRA_LDFLAGS = COMMON_HEADERS = linux-input-keycodes.h linux-input.h shared.h RCM_PACKAGES = libudev libsystemd RCM_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCM_PACKAGES}) RCM_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCM_PACKAGES}) RCM_COMPILE = $(CC) $(RCM_CFLAGS) RCM_LINK = $(CC) $(RCM_CFLAGS) $(RCM_LDFLAGS) RCM_OBJECTS = rcm-server-main.o rcm-server-keymap.o rcm-server-evdev.o shared.o RCM_HEADERS = rcm-server-main.h rcm-server-keymap.h rcm-server-evdev.h utils.h $(COMMON_HEADERS) RCC_PACKAGES = gtk+-3.0 RCC_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCC_PACKAGES}) RCC_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCC_PACKAGES}) RCC_COMPILE = $(CC) $(RCC_CFLAGS) RCC_LINK = $(CC) $(RCC_CFLAGS) $(RCC_LDFLAGS) RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-receive.o generated.o shared.o RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-receive.h generated.h $(COMMON_HEADERS) INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 DESTDIR ?= prefix = /usr usrbindir = ${prefix}/bin mandir = ${prefix}/share/man .SUFFIXES: # # Targets # all: rcm-server rcm-client .DEFAULT: all shared.o: shared.c shared.h $(CC) $(GENERIC_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< linux-input-keycodes.o: linux-input-keycodes.c $(COMMON_HEADERS) $(CC) $(GENERIC_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< rcm-client-%.o: rcm-client-%.c $(RCC_HEADERS) $(RCC_COMPILE) -o $@ -c $< generated.o: generated.c generated.h $(RCC_COMPILE) -o $@ -c $< generated.c generated.h: RemoteControlManager.xml gdbus-codegen --interface-prefix org.gnome --c-generate-object-manager --generate-c-code generated RemoteControlManager.xml rcm-client: $(RCC_OBJECTS) $(RCC_LINK) -o $@ $^ rcm-server-%.o: rcm-server-%.c $(RCM_HEADERS) $(RCM_COMPILE) -o $@ -c $< rcm-server: $(RCM_OBJECTS) $(RCM_LINK) -o $@ $^ install: all $(INSTALL_PROGRAM) -D rcm-server $(DESTDIR)$(usrbindir)/rcm-server uninstall: - rm -f $(DESTDIR)$(usrbindir)/rcm-server clean: - rm -f generated.[ch] *.o rcm-server rcm-client .PHONY: install uninstall clean all