File: Makefile

package info (click to toggle)
libssw 1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 28,088 kB
  • ctags: 264
  • sloc: ansic: 1,591; cpp: 493; python: 382; java: 136; makefile: 72; sh: 29
file content (63 lines) | stat: -rw-r--r-- 1,681 bytes parent folder | download | duplicates (2)
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
CC = gcc
CXX = g++
#CFLAGS := -Wall -pipe -O2
#CXXFLAGS := $(CFLAGS)
LOBJS = ssw.o
LCPPOBJS = ssw_cpp.o
PROG = ssw-align
SOVERS=.0
LIB = libssw.so$(SOVERS)
LLIB = libssw.so
STATICLIB = libssw.a
EXAMPLE = example_c
EXAMPLE_CPP = example_cpp
JAVA_JAR = ssw.jar
JAVA_LIB = libsswjni.so
JAVA_INLCUDES = -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/linux" -I/usr/lib/jvm/default-java/include/  -I/usr/lib/jvm/default-java/include/linux
JAVA_OBJ = ssw/Aligner.class ssw/Alignment.class

.PHONY: all default java clean

default: $(PROG) $(EXAMPLE) $(EXAMPLE_CPP) $(LIB) $(STATICLIB)

all: default java

java: $(JAVA_JAR) $(JAVA_LIB)

$(LIB): ssw.c ssw.h ssw_cpp.h ssw_cpp.cpp
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC -shared -rdynamic -Wl,-soname,$(LIB) -o $@ $^ $(LDFLAGS)

$(LLIB): $(LIB)
	ln -s $< $@

$(STATICLIB): $(LOBJS) $(LCPPOBJS)
	ar rcs $@ $^

$(PROG): main.c kseq.h $(LLIB)
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ main.c kseq.h -L. -lssw -lm -lz $(LDFLAGS)

$(EXAMPLE): example.c

$(EXAMPLE): $(LOBJS)
	$(CC) -o $@ $(filter-out %.h,$^) $(CPPFLAGS) $(CFLAGS) -lm -lz $(LDFLAGS)

$(EXAMPLE_CPP): example.cpp $(LOBJS) $(LCPPOBJS)
	$(CXX) -o $@ $^ $(CPPFLAGS) $(CXXFLAGS) -lm -lz $(LDFLAGS)

$(JAVA_LIB): sswjni.c ssw.c ssw.h
	$(CC) $(CPPFLAGS) $(CFLAGS) $(JAVA_INLCUDES) -fPIC -shared -rdynamic -o $@ $< ssw.c $(LDFLAGS)

$(JAVA_JAR): $(JAVA_OBJ)
	jar cvf $@ $^

%.class: %.java
	javac -target 1.6 -source 1.6 $<
	
ssw.o: ssw.c ssw.h
	$(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)

ssw_cpp.o: ssw_cpp.cpp ssw_cpp.h ssw.h
	$(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS)

clean:
	-rm -f $(LOBJS) $(LCPPOBJS) $(PROG) $(LIB) $(EXAMPLE) $(EXAMPLE_CPP) $(JAVA_LIB) *.jar $(JAVA_OBJ) *~ $(STATICLIB)