How write linux make file for php extension
I'm creating a php extension(which is a .c file named inirphp.c) with visual studio.net 2003 on windows side . Thie project includes many configurations, like including may directories. when using right mouse click on the project name, property, c/c++, Preprocessor/preprocessor definitions, (WIN 32, PHP_WIN32, ZEND_WIN32...) was added.
My project using php call the php extension works well on the windows side. Right now, we are moving to the linux(fedora) side. I'm try to write a make file to use to compile php extension and obtain a .so file. My php on the linux side will call this .so file.
My question is: how to include the php.h(in php extension windows side #include "php.h"? was used.) Need I include the similiar configuration like(WIN 32, PHP_WIN32, ZEND_WIN32...) on linux side?
my make file looks like this:
**********************
DEBUG_FLAGS = -g -DTRACE_ON
DEBUG_FLAGS =
USBLIBS = -L/usr/local/lib -lusb
PLATFORMDEF = -DUNIX -DLINUX
USBLIBS = -lusb
SHAREDFLAG = --shared --whole-archive
HID_C = CCHid.c
#I just put include directory -I/usr/Desktop, is that righgt
CC = gcc
CFLAGS = -fPIC -DMASTER $(PLATFORMDEF) -Wall -I/usr/Desktop/inirphp -I/usr/php/zend. $(DEBUG_FLAGS)
default: all
all: libinirphp.so libinirphp.a
SRCS = inirphp.c
OBJS = $(SRCS:%.c=%.o)
HDRS =
libinirphp.so: $(OBJS)
gcc $(SHAREDFLAG) -o libinirphp.so $(OBJS) $(USBLIBS)
libinirphp.a: $(OBJS)
ar rcs libinirphp.a $(OBJS)
clean: cleanup
rm -f libinirphp.*
cleanup:
rm -f *.o
install: libinirphp.so libinirphp.a
cp libinirphp.so install/
cp libinirphp.a install/
**************************
I really appreciate it, if anyone can give me any suggestion
Thank you so much in advance
Jane He
|