File: Makefile

package info (click to toggle)
libreadline-java 0.8.0.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 548 kB
  • ctags: 616
  • sloc: ansic: 1,707; java: 633; makefile: 191
file content (118 lines) | stat: -rw-r--r-- 3,663 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
111
112
113
114
115
116
117
118
#**************************************************************************
#* Makefile for libJava*.so -- load library for JNI wrapper of
#* of GNU readline
#*
#* Copyright (c) 1987-1998 Free Software Foundation, Inc.
#* Java Wrapper Copyright (c) 1998-2001 by Bernhard Bablok (mail@bablokb.de)
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU Library General Public License as published
#* by  the Free Software Foundation; either version 2 of the License or
#* (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful, but
#* WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#* GNU Library General Public License for more details.
#*
#* You should have received a copy of the GNU Library General Public License
#* along with this program; see the file COPYING.LIB.  If not, write to
#* the Free Software Foundation Inc., 59 Temple Place - Suite 330,
#* Boston, MA  02111-1307 USA
#***************************************************************************
#
# Makefile for JNI-library libJava*.so
#
# $Author: bablokb $
# $Revision: 1.13 $
#

export 

.PHONY: org_gnu_readline_Readline.o

ROOTDIR=../..
BUILDDIR=$(ROOTDIR)/build

ifeq (MSC,$(WIN32))
INCLUDES = -I "c:/Programme/DevStudio/VC/include" \
			-I $(JAVAINCLUDE) -I $(JAVANATINC)
LIB = "c:/Programme/DevStudio/VC/lib"
CC = cl
OBJ_EXT := obj
LIB_PRE := 
LIB_EXT := dll
CFLAGS=-DWIN32=$(WIN32) -D__IBMC__
else
INCLUDES          = -I $(JAVAINCLUDE) -I $(JAVAINCLUDE)/linux -I $(JAVANATINC) -I $(JAVANATINC)/linux
LIBPATH           = -L/usr/lib/termcap 
JavaReadline_LIBS = -lreadline -ltermcap -lhistory
JavaEditline_LIBS = -ledit -ltermcap
ifeq (cygwin,$(WIN32))
JavaGetline_LIBS = -lcygwin
endif
CC = gcc
OBJ_EXT := o
LIB_PRE := lib
LIB_EXT := so
CFLAGS+=-fPIC -DPOSIX
endif


OBJECTS := org_gnu_readline_Readline.$(OBJ_EXT)
ifeq ($(TG),JavaGetline)
OBJECTS += getline.$(OBJ_EXT)
endif

all: $(T_LIBS) 

lib: $(ROOTDIR)/$(LIB_PRE)$(TG).$(LIB_EXT)

JavaReadline:
	make TG=$@ lib

JavaEditline:
	make TG=$@ lib

JavaGetline:
	make TG=$@ lib

$(ROOTDIR)/$(LIB_PRE)$(TG).$(LIB_EXT): $(OBJECTS)
ifeq (MSC,$(WIN32))
	$(CC) $(INCLUDES) -LD $(OBJECTS) -Fe$@
else
ifeq (CYGWIN,$(WIN32))
	$(CC) -s -W1,--base-file,$(ROOTDIR)/lib$(TG).base -o $@ \
		$(OBJECTS) -W1,-e,_readline_init@12
	dlltool --base-file $(ROOTDIR)/lib$(TG).base \
		--def $(ROOTDIR)/lib$(TG).def \
		--output-exp $(ROOTDIR)/lib$(TG).exp \
		--dllname $(ROOTDIR)/lib$(TG).dll
	$(CC) -s -W1,--base-file $(ROOTDIR)/lib$(TG).base,$(ROOTDIR)/lib$(TG).exp \
		-o $@ $(OBJECTS) -W1,-e,_readline_init@12
	dlltool --base-file $(ROOTDIR)/lib$(TG).base \
		--def $(ROOTDIR)/lib$(TG).def \
		--output-exp $(ROOTDIR)/lib$(TG).exp \
		--dllname $(ROOTDIR)/lib$(TG).dll
	$(CC) -W1,$(ROOTDIR)/lib$(TG).exp -o $@ \
		$(OBJECTS) -W1,-e,_readline_init@12
else
	$(CC) $(LDFLAGS) -shared $(OBJECTS) $(LIBPATH) $($(TG)_LIBS) -o $@
endif
endif

getline.$(OBJ_EXT): getline.c
	$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -D$(TG) -c getline.c

org_gnu_readline_Readline.$(OBJ_EXT): org_gnu_readline_Readline.h \
	                                      org_gnu_readline_Readline.c
	$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -D$(TG) \
	                                   -c org_gnu_readline_Readline.c

org_gnu_readline_Readline.h: $(BUILDDIR)/org/gnu/readline/Readline.class
	$(JAVA_HOME)/bin/javah -classpath $(BUILDDIR) -jni org.gnu.readline.Readline
	touch org_gnu_readline_Readline.h

clean:
	-rm -f org_gnu_readline_Readline.h \
		org_gnu_readline_Readline.$(OBJ_EXT) getline.$(OBJ_EXT)