-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
67 lines (45 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
EXECUTABLE := fxtract
util := util
OBJECTS := main.o fileManager.o fx.o util.o kseq.o
PREFIX := /usr/local/bin
LIBZ := 1
PCRE_PATH := -lpcre
LIBZ_PATH := -lz
LIBS :=
SYSTEM_NAME := $(shell uname -s)
PACKAGE_VERSION = 2.3
PACKAGE_DATE = "2016-01-12"
ifndef NO_PCRE
LIBS += $(PCRE_PATH)
CFLAGS += -DHAVE_PCRE
endif
ifeq ($(LIBZ), 1)
CFLAGS += -DHAVE_LIBZ
LIBS += $(LIBZ_PATH)
endif
#include $(util)/GNUmakefile
$(util)/libmsutil.a:
$(MAKE) -C $(util)
ifneq "$(wildcard .git)" ""
PACKAGE_VERSION := $(shell git describe --always)
PACKAGE_DATE := $(shell git log -n 1 --pretty="%ai" )
# Force version.h to be remade if $(PACKAGE_VERSION) has changed.
version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))
endif
version.h:
echo '#define PACKAGE_VERSION "$(PACKAGE_VERSION)"' > $@
echo '#define PACKAGE_DATE "$(PACKAGE_DATE)"' >> $@
force:
.PHONY: force static
all: $(EXECUTABLE)
static: $(EXECUTABLE)$(PACKAGE_VERSION)-$(SYSTEM_NAME)-64bit-static
install: $(EXECUTABLE)
$(INSTALL) -dc $< $(PREFIX)
fxtract_test: $(EXECUTABLE)
cd $@ && ./run.sh
main.o: main.cpp version.h
$(CXX) $(CFLAGS) -c -o $@ $<
$(EXECUTABLE): version.h $(OBJECTS) $(util)/libmsutil.a
$(CXX) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(util)/libmsutil.a $(LIBS)
$(EXECUTABLE)$(PACKAGE_VERSION)-$(SYSTEM_NAME)-64bit-static: version.h $(OBJECTS) $(util)/libmsutil.a
$(CXX) $(CFLAGS) -static -o $@ $(OBJECTS) $(util)/libmsutil.a $(LIBS)