hasufell-repository/packages/dev-util/bam/files/bam-0.4.0-Add-Makefile.patch

72 lines
1.7 KiB
Diff
Raw Permalink Normal View History

From c74e0bde7033139427bc2812c6ee0f68d6e15962 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Thu, 19 May 2016 17:32:16 +0200
Subject: [PATCH] Add Makefile
Upstram: pending, https://github.com/matricks/bam/pull/92
This is needed to package bam correctly in linux distributions.
The current shell script is insufficient and doesn't give enough control.
---
Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4eace57
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+# install directories
+INSTALL_PREFIX = /usr
+INSTALL_BINDIR = $(INSTALL_PREFIX)/bin
+
+
+# toolchain
+PKG_CONFIG ?= pkg-config
+PYTHON ?= python
+
+
+# flags
+LUA_LIBS := $(shell $(PKG_CONFIG) --libs lua 2>/dev/null || echo "-llua")
+LIBS += -lm -lpthread $(LUA_LIBS) -ldl
+LUA_CFLAGS := $(shell $(PKG_CONFIG) --cflags lua 2>/dev/null || echo "-I/usr/include/lua")
+CFLAGS += $(LUA_CFLAGS)
+
+
+# objects
+TARGETS = txt2c internal_base bam
+BAM_OBJ = $(patsubst %.c,%.o,$(wildcard src/*.c))
+TXT2C_LUA = $(wildcard src/*.lua)
+
+
+# make rules
+all: $(TARGETS)
+
+txt2c: src/tools/txt2c
+
+internal_base: src/internal_base.h
+
+src/internal_base.h:
+ src/tools/txt2c $(TXT2C_LUA) > src/internal_base.h
+
+bam: txt2c internal_base $(BAM_OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BAM_OBJ) $(LIBS)
+
+test: $(TARGETS)
+ $(PYTHON) scripts/test.py
+
+install: bam
+ install -d "$(DESTDIR)$(INSTALL_BINDIR)"
+ install -m755 bam "$(DESTDIR)$(INSTALL_BINDIR)"/bam
+
+clean:
+ rm -f $(BAM_OBJ) $(TARGETS) src/internal_base.h src/tools/txt2c
+
+
+.PHONY: all test install clean
+
--
2.8.1