Skip to content

Commit

Permalink
Merge pull request #528 from NobletSolutions/patch-example-makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielBruijntjes authored Apr 27, 2024
2 parents 1012391 + 42c4581 commit f8982ea
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 63 deletions.
14 changes: 8 additions & 6 deletions Examples/CallPhpFunctions/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +26,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/ConstStaticProp/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
2 changes: 1 addition & 1 deletion Examples/CppClassesInPhp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NAME = cppclassinphp
# one for each extension. Use this variable to specify this directory.
#

INI_DIR = /etc/php5/conf.d
INI_DIR = $(shell php-config --ini-dir)


#
Expand Down
2 changes: 1 addition & 1 deletion Examples/DlUnrestricted/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NAME = dlunrestricted
# one for each extension. Use this variable to specify this directory.
#

INI_DIR = /etc/php5/mods-available
INI_DIR = $(shell php-config --ini-dir)


#
Expand Down
2 changes: 1 addition & 1 deletion Examples/EmptyExtension/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NAME = yourextension
# one for each extension. Use this variable to specify this directory.
#

INI_DIR = /etc/php5/mods-available/
INI_DIR = $(shell php-config --ini-dir)


#
Expand Down
13 changes: 8 additions & 5 deletions Examples/Exceptions/ExceptionCatch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/Exceptions/ExceptionThrow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/Extension/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/FunctionNoParameters/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/FunctionReturnValue/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/FunctionVoid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/FunctionWithParameters/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
#Edit these lines to correspond with your own directories
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
13 changes: 8 additions & 5 deletions Examples/Globals/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -O2 -std=c++11

PREFIX = /usr
PHP_CONFIG = php-config
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = /etc/php5/cli/conf.d
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -shared -O2
Expand All @@ -28,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}
2 changes: 1 addition & 1 deletion Examples/ReturnObject/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NAME = returnobject
# one for each extension. Use this variable to specify this directory.
#

INI_DIR = /etc/php5/mods-available/
INI_DIR = $(shell php-config --ini-dir)


#
Expand Down
17 changes: 9 additions & 8 deletions Examples/simple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ CPP = g++
RM = rm -f
CPP_FLAGS = -Wall -c -I. -I/home/work/include/ -O2 -std=c++11

PREFIX = /home/work/

#Edit these lines to correspond with your own directories
LIBRARY_DIR = ${PREFIX}/local/php/lib/php/extensions/no-debug-non-zts-20090626/

PHP_CONFIG_DIR = /home/work/local/php/lib/
PHP_CONFIG = $(shell which php-config)
LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir)
PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir)

LD = g++
LD_FLAGS = -Wall -Wl,-rpath,/home/work/lib -shared -O2 -L/home/work/lib
Expand All @@ -30,5 +27,9 @@ ${OBJECTS}:
${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp}

install:
cp -f ${RESULT} ${LIBRARY_DIR}
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}
cp -f ${RESULT} ${LIBRARY_DIR}/
cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/

uninstall:
rm ${LIBRARY_DIR}/${RESULT}
rm ${PHP_CONFIG_DIR}/${PHPINIFILE}

0 comments on commit f8982ea

Please sign in to comment.