LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2006, 03:32 PM   #1
Janehe
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux file extension vs Dos file Extension? manaa Linux - Newbie 6 02-12-2009 04:19 PM
Apache/PHP - can't write file Influx Linux - Software 3 10-23-2005 10:50 PM
Red Hat 9 server can't write PHP script, problem in httpd.conf file? x_menno_x Linux - Newbie 27 06-29-2004 04:44 PM
Apache 1.3.28/PHP 4.3.3 can't write temp file tm_burningdog Linux - Software 0 06-10-2004 01:49 PM
php script can not write text file lemotion Linux - Newbie 5 04-20-2004 10:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration