Skip to content

Instantly share code, notes, and snippets.

@paoneJP
Created April 16, 2015 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paoneJP/cfa8650e20b33e4506d4 to your computer and use it in GitHub Desktop.
Save paoneJP/cfa8650e20b33e4506d4 to your computer and use it in GitHub Desktop.
auxiliary makefile for building apache module on various linux distro.
module_name=$(patsubst mod_%,%,$(shared:%.la=%))
ifneq ($(wildcard /etc/debian_version),)
# Debian/Ubuntu
top_srcdir=/usr/share/apache2
top_builddir=/usr/share/apache2
include /usr/share/apache2/build/special.mk
loader_file=/etc/apache2/mods-available/$(module_name).load
loader_lines=LoadModule $(module_name)_module $(libexecdir)/mod_$(module_name).so
else ifneq ($(wildcard /etc/redhat-release),)
# RHEL/CentOS
top_srcdir=/etc/httpd
ifneq ($(wildcard /usr/lib64),) # 64bit
top_builddir=/usr/lib64/httpd
include /usr/lib64/httpd/build/special.mk
else
top_builddir=/usr/lib/httpd
include /usr/lib/httpd/build/special.mk
endif
ifneq ($(wildcard /etc/httpd/conf.modules.d),) # CentOS7
loader_file=/etc/httpd/conf.modules.d/99-$(module_name).conf-
else
loader_file=/etc/httpd/conf.d/$(module_name).conf-
endif
loader_lines=LoadModule $(module_name)_module modules/mod_$(module_name).so
else
$(error unsupported platform)
endif
install-loader-config:
echo -e "$(loader_lines)" > $(loader_file)
chmod 644 $(loader_file)
install: install-modules-yes install-loader-config
##
## Makefile -- Build procedure for sample your_module Apache module
## Autogenerated via ``apxs -n your_module -g''.
##
builddir=.
#top_srcdir=/usr/share/apache2
#top_builddir=/usr/share/apache2
#include /usr/share/apache2/build/special.mk
include distro_support.mk
# the used tools
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment