blob: e899de3effd2812bea50d4d7d5d3f01c4219bb0a [file] [log] [blame]
Tomas Cejka96f4e612012-12-10 00:03:32 +01001PKGNAME = @PACKAGE_NAME@
2NAME=mod_netconf
3VERSION = $(shell cut -f1 ./VERSION | tr -d '\n')
4MAJOR_VER = $(shell echo $(VERSION) | cut -d. -f1)
5RELEASE = @RELEASE@
6RPMDIR = RPMBUILD
7RPMBUILD = @RPMBUILD@
8
Tomas Cejka689a1042013-01-16 15:08:25 +01009IDGIT = "built from git $(shell git show --pretty=oneline | head -1 | cut -c -20)"
10IDNOGIT = "released as version $(VERSION)"
Tomas Cejka96f4e612012-12-10 00:03:32 +010011prefix = @prefix@
12exec_prefix = @exec_prefix@
13datarootdir = @datarootdir@
14datadir = @datadir@
15bindir = @bindir@
16includedir = @includedir@
17libdir = @libdir@
18mandir = @mandir@
19sysconfdir = @sysconfdir@
20
Tomas Cejka689a1042013-01-16 15:08:25 +010021ARCSID = @ARCSID@
22RCSID = @RCSID@
23
Tomas Cejka96f4e612012-12-10 00:03:32 +010024APXS=/usr/sbin/apxs
25
26CFLAGS=-I/usr/include/json
Tomas Cejkad340dbf2013-03-24 20:36:57 +010027CPPFLAGS=@CPPFLAGS@
28LIBS=@LIBS@
Tomas Cejka96f4e612012-12-10 00:03:32 +010029
30SRCS=mod_netconf.c \
Tomas Cejkaba21b382013-04-13 02:37:32 +020031 notification-server.c \
Tomas Cejka96f4e612012-12-10 00:03:32 +010032 test-client.c
33
Tomas Cejkaba21b382013-04-13 02:37:32 +020034HDRS=message_type.h \
35 notification_module.h \
36 mod_netconf.h
Tomas Cejka4ce5d0a2013-01-17 19:23:54 +010037
Tomas Cejka96f4e612012-12-10 00:03:32 +010038all: module client
39
40module: mod_netconf.c
Tomas Cejkad340dbf2013-03-24 20:36:57 +010041 $(APXS) $(LIBS) $(ARCSID) $(CPPFLAGS) -c mod_netconf.c notification-server.c
Tomas Cejka96f4e612012-12-10 00:03:32 +010042
43client: test-client.c
Tomas Cejka689a1042013-01-16 15:08:25 +010044 gcc $(RCSID) -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client
Tomas Cejka96f4e612012-12-10 00:03:32 +010045
Tomas Cejkad340dbf2013-03-24 20:36:57 +010046notification-test: notification-server.c
47 gcc $(RCSID) -std=gnu99 -Wall -g -lwebsockets -DTEST_NOTIFICATION_SERVER notification-server.c -o notification-test
48
Tomas Cejka96f4e612012-12-10 00:03:32 +010049#install: $(NAME).la
50# $(APXS) -i $(NAME).la
51
52.PHONY: install
53install: $(TARGETS)
54 [ -d $(DESTDIR)/etc/httpd/modules ] || \
55 (mkdir -p $(DESTDIR)/$(libdir)/httpd/modules; chmod 755 $(DESTDIR)/$(libdir)/httpd/modules)
56 [ -d $(DESTDIR)/$(sysconfdir)/httpd/conf.d/ ] || \
57 mkdir -p $(DESTDIR)/$(sysconfdir)/httpd/conf.d/; chmod 755 $(DESTDIR)/$(sysconfdir)/httpd/conf.d/;
58 cp .libs/mod_netconf.so $(DESTDIR)/$(libdir)/httpd/modules
59 cp mod_netconf.conf $(DESTDIR)/$(sysconfdir)/httpd/conf.d/
60
61.PHONY: clean
62clean:
63 rm -rf .libs *.la *.lo *.slo test-client
64
65.PHONY: tarball
66tarball: $(SRCS) $(HEADERS)
67 @rm -rf $(NAME)-$(VERSION);
68 @mkdir $(NAME)-$(VERSION);
69 for i in $(SRCS) $(HDRS) mod_netconf.conf README configure.in configure \
70 Makefile.in VERSION $(NAME).spec.in install-sh; do \
71 [ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \
72 cp $$i $(NAME)-$(VERSION)/$$i; \
73 done;
74 @rm -rf $(RPMDIR)/SOURCES/; \
75 mkdir -p $(RPMDIR)/SOURCES/; \
76 tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \
77 $(NAME)-$(VERSION); \
78 rm -rf $(NAME)-$(VERSION);
79
80.PHONY: rpm
81rpm: tarball
82 mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS
83 $(RPMBUILD) -ba $(PKGNAME).spec \
84 --define "_topdir `pwd`/$(RPMDIR)";
85
86.PHONY: distclean
87distclean:
88 rm -rf $(RPMDIR)