File: Makefile

package info (click to toggle)
foma 1:0.9.18+r243-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 872 kB
  • sloc: ansic: 13,797; lex: 1,390; yacc: 315; python: 274; perl: 147; makefile: 99
file content (110 lines) | stat: -rw-r--r-- 3,308 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
prefix = $(DESTDIR)/usr
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib/$(DEB_HOST_MULTIARCH)
bindir = $(exec_prefix)/bin
includedir = $(prefix)/include

VERSION = 0.9.18
SVN_REV = $(shell svn info | grep "Last Changed Rev" | cut -f4 -d\ )
CC = gcc
RANLIB = ranlib
YACC = bison -v
LEX = flex -8
LEXCLEX = flex -8 --prefix=lexc
LEXIFACE = flex -8 --prefix=interface
LEXCMATRIX = flex -8 --prefix=cmatrix
RM = /bin/rm -f
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -lreadline -lz -ltermcap -z relro
FLOOKUPLDFLAGS = libfoma.a -lz
CFLAGS = $(shell dpkg-buildflags --get CFLAGS) -Wall -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC -Wl,-z,relro
FOMAOBJS = foma.o stack.o iface.o lex.interface.o
LIBOBJS = int_stack.o define.o determinize.o apply.o rewrite.o lexcread.o topsort.o flags.o minimize.o reverse.o extract.o sigma.o io.o structures.o constructions.o coaccessible.o utf8.o spelling.o dynarray.o mem.o stringhash.o trie.o lex.lexc.o lex.yy.o lex.cmatrix.o regex.o

all: libfoma foma flookup cgflookup

foma: $(FOMAOBJS) $(LIBOBJS)
	$(CC) $(CFLAGS) $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@

flookup: flookup.o libfoma
	$(CC) $(CFLAGS) flookup.o $(FLOOKUPLDFLAGS) -o $@

cgflookup: cgflookup.o libfoma
	$(CC) $(CFLAGS) cgflookup.o $(FLOOKUPLDFLAGS) -o $@

STATICLIB = libfoma.a

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
	SHAREDLIB = libfoma.dylib
	SHAREDLIBV = libfoma.$(VERSION).dylib
	SHAREDLIBM = libfoma.0.dylib
	AR = libtool
	ARFLAGS = -static -o
	DFLAG = -dylib_install_name
else 
	SHAREDLIB = libfoma.so
	SHAREDLIBV = libfoma.so.$(VERSION)
	SHAREDLIBM = libfoma.so.0
	AR = ar
	ARFLAGS = cru
	DFLAG = -soname
endif

ifeq ($(UNAME), SunOS)
	DFLAG = -h
	FLOOKUPLDFLAGS = libfoma.a -lz -lsocket -lnsl
endif

ifeq ($(UNAME), CYGWIN_NT-5.1)
	LDFLAGS = /usr/lib/libreadline.dll.a /usr/lib/libz.a
	FLOOKUPLDFLAGS = libfoma.a /usr/lib/libz.a
endif

LIBS = $(SHAREDLIBV) $(STATICLIB)

libfoma: $(SHAREDLIBV)

$(SHAREDLIBV): $(LIBOBJS)
	$(AR) $(ARFLAGS) $(STATICLIB) $(LIBOBJS)
	$(RANLIB) $(STATICLIB)
	$(CC) $(CFLAGS) -shared -Wl,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)

install: foma libfoma
	-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
	-@if [ ! -d $(includedir)  ]; then mkdir -p $(includedir); fi
	-@if [ ! -d $(libdir)      ]; then mkdir -p $(libdir); fi
	-@if [ ! -d $(bindir)      ]; then mkdir -p $(bindir); fi
	cp fomalib.h fomalibconf.h $(includedir);
	chmod 644 $(includedir)/fomalib.h
	cp foma flookup cgflookup $(bindir)
	cp $(LIBS) $(libdir)
	cd $(libdir); chmod 755 $(LIBS); \
	if test -f $(libdir)/$(SHAREDLIB); then rm  $(libdir)/$(SHAREDLIB); fi
	if test -f $(libdir)/$(SHAREDLIBM); then rm  $(libdir)/$(SHAREDLIBM); fi
	cd $(libdir); ln -s $(SHAREDLIBV) $(SHAREDLIB); cd $(libdir);	\
	ln -s $(SHAREDLIBV) $(SHAREDLIBM); (ldconfig || true)		\
	>/dev/null 2>&1; \

$(OBJS): foma.h

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

lex.yy.c: regex.l regex.h
	$(LEX) regex.l

lex.lexc.c: lexc.l
	$(LEXCLEX) $<

lex.interface.c: interface.l
	$(LEXIFACE) $<

lex.cmatrix.c: cmatrix.l
	$(LEXCMATRIX) $<

regex.c regex.h: regex.y
	$(YACC) --defines=$*.h --output=$*.c $<

clean:
	$(RM) foma flookup cgflookup $(FOMAOBJS) $(LIBOBJS) flookup.o cgflookup.o regex.h regex.c regex.output lex.yy.c lex.lexc.c lex.interface.c lex.cmatrix.c *.so* *.dylib* *.a