45 lines
891 B
Plaintext
45 lines
891 B
Plaintext
|
OUT = aseawk
|
||
|
|
||
|
C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \
|
||
|
run.c rec.c val.c func.c misc.c extio.c rex.c
|
||
|
JNI_SRCS = jni.c
|
||
|
JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java
|
||
|
|
||
|
C_OBJS = $(C_SRCS:.c=.o)
|
||
|
JNI_OBJS = $(JNI_SRCS:.c=.o)
|
||
|
JAVA_OBJS = $(JAVA_SRCS:.java=.class)
|
||
|
|
||
|
JNI_INCPATH= \
|
||
|
-I"$(JAVA_HOME)/include" \
|
||
|
-I"$(JAVA_HOME)/include/solaris"
|
||
|
|
||
|
CC = gcc
|
||
|
AR = ar
|
||
|
LD = ld
|
||
|
RANLIB = ranlib
|
||
|
CFLAGS = -m64 -Wall -O2 -D_REENTRANT -D_THREAD_SAFE -fPIC -I../.. $(JNI_INCPATH)
|
||
|
LDFLAGS =
|
||
|
LIBS =
|
||
|
|
||
|
JAVAC = javac
|
||
|
JAVACFLAGS = -classpath ../..
|
||
|
|
||
|
all: lib jni
|
||
|
|
||
|
lib: $(C_OBJS)
|
||
|
$(AR) cr lib$(OUT).a $(C_OBJS)
|
||
|
|
||
|
jni: lib $(JNI_OBJS) $(JAVA_OBJS)
|
||
|
$(CC) -shared -o $(OUT)_jni.so $(JNI_OBJS) -lm -L. -l$(OUT)
|
||
|
|
||
|
clean:
|
||
|
rm -rf $(C_OBJS) $(JNI_OBJS) $(JAVA_OBJS) lib$(OUT).a lib$(OUT).so *.o
|
||
|
|
||
|
.SUFFIXES: .c .o .java .class
|
||
|
.c.o:
|
||
|
$(CC) $(CFLAGS) -c $<
|
||
|
|
||
|
.java.class:
|
||
|
$(JAVAC) $(JAVACFLAGS) $<
|
||
|
|