aboutsummaryrefslogtreecommitdiffstats
path: root/Make.rules
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2013-09-03 09:48:41 +0200
committeretobi <git@e-tobi.net>2013-09-03 09:48:41 +0200
commitab959d7b4194715870128e616b8e29d4a101e488 (patch)
tree61a746231d30817be73416a7d67763fd677a1042 /Make.rules
parent6b350466c4902c5b137e0efaf1d189128a7f18f5 (diff)
downloadlinux-dvb-apps-ab959d7b4194715870128e616b8e29d4a101e488.tar.gz
Imported Upstream version 1.1.1+rev1207upstream/1.1.1+rev1207
Diffstat (limited to '')
-rw-r--r--Make.rules104
1 files changed, 104 insertions, 0 deletions
diff --git a/Make.rules b/Make.rules
new file mode 100644
index 0000000..e867c3a
--- /dev/null
+++ b/Make.rules
@@ -0,0 +1,104 @@
+# build rules for linuxtv.org dvb-apps
+
+CFLAGS ?= -g -Wall -W -Wshadow -Wpointer-arith -Wstrict-prototypes
+
+ifneq ($(lib_name),)
+
+# additional rules for libraries
+
+CFLAGS_LIB ?= -fPIC
+CFLAGS += $(CFLAGS_LIB)
+
+libraries = $(lib_name).so $(lib_name).a
+
+.PHONY: library
+
+library: $(libraries)
+
+$(libraries): $(objects)
+
+endif
+
+prerequisites = $(subst .o,.d,$(objects)) $(addsuffix .d,$(binaries))
+
+.PHONY: clean install
+
+ifeq ($(static),1)
+LDFLAGS += -static
+endif
+
+prefix ?= /usr
+
+bindir ?= $(prefix)/bin
+includedir ?= $(prefix)/include
+libdir ?= $(prefix)/lib
+sharedir ?= $(prefix)/share
+
+ifneq ($(DESTDIR),)
+DESTDIR = $(DESTDIR)/
+endif
+
+ifeq ($(V),1)
+%.o: %.c
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) -MMD -o $@ $< $(filter-out %.h %.c,$^)
+%: %.o
+ $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
+%: %.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MMD $(LDFLAGS) -o $@ $< $(filter-out %.h %.c,$^) $(LOADLIBES) $(LDLIBS)
+%.so:
+ $(CC) -shared -o $@ $^
+%.a:
+ $(AR) rcs $@ $^
+clean::
+ $(RM) -f $(prerequisites) $(objects) $(libraries) $(binaries) $(removing) *~
+install::
+ifneq ($(includes),)
+ mkdir -p $(DESTDIR)$(includedir)/$(lib_name)
+ install -m 644 $(includes) $(DESTDIR)$(includedir)/$(lib_name)/
+endif
+ifneq ($(libraries),)
+ mkdir -p $(DESTDIR)$(libdir)
+ install -m 644 $(libraries) $(DESTDIR)$(libdir)/
+endif
+ifneq ($(inst_bin),)
+ mkdir -p $(DESTDIR)$(bindir)
+ install -m 755 $(inst_bin) $(DESTDIR)$(bindir)/
+endif
+else
+%.o: %.c
+ @echo CC $@
+ @$(CC) -c $(CPPFLAGS) $(CFLAGS) -MMD -o $@ $< $(filter-out %.h %.c,$^)
+%: %.o
+ @echo CC $@
+ @$(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
+%: %.c
+ @echo CC $@
+ @$(CC) $(CPPFLAGS) $(CFLAGS) -MMD $(LDFLAGS) -o $@ $< $(filter-out %.h %.c,$^) $(LOADLIBES) $(LDLIBS)
+%.so:
+ @echo CC $@
+ @$(CC) -shared -o $@ $^
+%.a:
+ @echo AR $@
+ @$(AR) rcs $@ $^
+clean::
+ @echo cleaning
+ @$(RM) -f $(prerequisites) $(objects) $(libraries) $(binaries) $(removing) *~
+install::
+ifneq ($(includes),)
+ @echo installing headers
+ @mkdir -p $(DESTDIR)$(includedir)/$(lib_name)
+ @install -m 644 $(includes) $(DESTDIR)$(includedir)/$(lib_name)/
+endif
+ifneq ($(libraries),)
+ @echo installing libraries
+ @mkdir -p $(DESTDIR)$(libdir)
+ @install -m 644 $(libraries) $(DESTDIR)$(libdir)/
+endif
+ifneq ($(inst_bin),)
+ @echo installing binaries
+ @mkdir -p $(DESTDIR)$(bindir)
+ @install -m 755 $(inst_bin) $(DESTDIR)$(bindir)/
+endif
+endif
+
+-include $(prerequisites)