blob: 463ae55e5e146786d1ed388c984768c395cbcdff [file] [log] [blame]
PKGNAME = @PACKAGE_NAME@
NAME=mod_netconf
VERSION = $(shell cut -f1 ./VERSION | tr -d '\n')
MAJOR_VER = $(shell echo $(VERSION) | cut -d. -f1)
RELEASE = @RELEASE@
RPMDIR = RPMBUILD
RPMBUILD = @RPMBUILD@
IDGIT = "built from git $(shell git show --pretty=oneline | head -1 | cut -c -20)"
IDNOGIT = "released as version $(VERSION)"
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
sysconfdir = @sysconfdir@
ARCSID = @ARCSID@
RCSID = @RCSID@
APXS=/usr/sbin/apxs
CFLAGS=@CFLAGS@
LIBS=@LIBS@
SRCS=mod_netconf.c \
notification-server.c \
test-client.c
HDRS=message_type.h \
notification_module.h \
mod_netconf.h
all: module client webgui-backend
module: mod_netconf.c
$(APXS) $(LIBS) $(ARCSID) $(CFLAGS) -c mod_netconf.c notification-server.c
client: test-client.c
gcc $(RCSID) -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client
notification-test: notification-server.c
gcc $(RCSID) -std=gnu99 -Wall -g -lwebsockets -DTEST_NOTIFICATION_SERVER notification-server.c -o notification-test
#install: $(NAME).la
# $(APXS) -i $(NAME).la
.PHONY: install
install: $(TARGETS)
[ -d $(DESTDIR)/etc/httpd/modules ] || \
(mkdir -p $(DESTDIR)/$(libdir)/httpd/modules; chmod 755 $(DESTDIR)/$(libdir)/httpd/modules)
[ -d $(DESTDIR)/$(sysconfdir)/httpd/conf.d/ ] || \
mkdir -p $(DESTDIR)/$(sysconfdir)/httpd/conf.d/; chmod 755 $(DESTDIR)/$(sysconfdir)/httpd/conf.d/;
cp .libs/mod_netconf.so $(DESTDIR)/$(libdir)/httpd/modules
cp mod_netconf.conf $(DESTDIR)/$(sysconfdir)/httpd/conf.d/
.PHONY: clean
clean:
rm -rf .libs *.la *.lo *.slo test-client webgui-backend
.PHONY: tarball
tarball: $(SRCS) $(HEADERS)
@rm -rf $(NAME)-$(VERSION);
@mkdir $(NAME)-$(VERSION);
for i in $(SRCS) $(HDRS) mod_netconf.conf README configure.in configure \
Makefile.in VERSION $(NAME).spec.in install-sh; do \
[ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \
cp $$i $(NAME)-$(VERSION)/$$i; \
done;
@rm -rf $(RPMDIR)/SOURCES/; \
mkdir -p $(RPMDIR)/SOURCES/; \
tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \
$(NAME)-$(VERSION); \
rm -rf $(NAME)-$(VERSION);
.PHONY: rpm
rpm: tarball
mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS
$(RPMBUILD) -ba $(PKGNAME).spec \
--define "_topdir `pwd`/$(RPMDIR)";
.PHONY: distclean
distclean:
rm -rf $(RPMDIR)
webgui-backend: mod_netconf.c notification-server.c mod_netconf.h
gcc -Wall -g $(CFLAGS) -DHTTPD_INDEPENDENT $(RCSID) `apr-1-config --cflags --cppflags --includes --link-ld` -I/usr/include/httpd $(LIBS) -laprutil-1 -o $@ mod_netconf.c notification-server.c