summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-06-29 23:10:08 +0200
committerDavid Härdeman <david@hardeman.nu>2015-06-29 23:10:08 +0200
commitcf2f0b97355586d75b740d6a0d1f576df436e783 (patch)
tree253c6786aee6294a36b15eaea8160332928c5646 /Makefile
Initial commit
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
+