summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c514d8d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2015 David Härdeman <david@hardeman.nu>
+#
+
+#
+# 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 =
+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})
+INSTALL = install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+RCM_COMPILE = $(CC) $(RCM_CFLAGS)
+RCM_LINK = $(CC) $(RCM_CFLAGS) $(RCM_LDFLAGS)
+RCM_SERVER_OBJ = rcm-server.o
+RCM_SERVER_HDR = utils.h
+
+DESTDIR ?=
+prefix = /usr
+usrbindir = ${prefix}/bin
+mandir = ${prefix}/share/man
+
+.SUFFIXES:
+
+#
+# Targets
+#
+
+all: rcm-server
+.DEFAULT: all
+
+%.o: %.c $(RCM_SERVER_HDR)
+ $(RCM_COMPILE) -o $@ -c $<
+
+rcm-server: $(RCM_SERVER_OBJ)
+ $(RCM_LINK) -o $@ $^
+
+install: all
+ $(INSTALL_PROGRAM) -D rcm-server $(DESTDIR)$(usrbindir)/rcm-server
+
+uninstall:
+ - rm -f $(DESTDIR)$(usrbindir)/rcm-server
+
+clean:
+ - rm -f *.o rcm-server
+
+.PHONY: install uninstall clean all
+