blob: b3c983de5ed97aa6f954e7ff15d68bc1a6713e78 [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
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020026CFLAGS=@CFLAGS@
Tomas Cejkad340dbf2013-03-24 20:36:57 +010027LIBS=@LIBS@
Tomas Cejka96f4e612012-12-10 00:03:32 +010028
29SRCS=mod_netconf.c \
Tomas Cejkaba21b382013-04-13 02:37:32 +020030 notification-server.c \
Tomas Cejka96f4e612012-12-10 00:03:32 +010031 test-client.c
32
Tomas Cejkaba21b382013-04-13 02:37:32 +020033HDRS=message_type.h \
34 notification_module.h \
35 mod_netconf.h
Tomas Cejka4ce5d0a2013-01-17 19:23:54 +010036
Tomas Cejka96f4e612012-12-10 00:03:32 +010037all: module client
38
39module: mod_netconf.c
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020040 $(APXS) $(LIBS) $(ARCSID) $(CFLAGS) -c mod_netconf.c notification-server.c
Tomas Cejka96f4e612012-12-10 00:03:32 +010041
42client: test-client.c
Tomas Cejka689a1042013-01-16 15:08:25 +010043 gcc $(RCSID) -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client
Tomas Cejka96f4e612012-12-10 00:03:32 +010044
Tomas Cejkad340dbf2013-03-24 20:36:57 +010045notification-test: notification-server.c
46 gcc $(RCSID) -std=gnu99 -Wall -g -lwebsockets -DTEST_NOTIFICATION_SERVER notification-server.c -o notification-test
47
Tomas Cejka96f4e612012-12-10 00:03:32 +010048#install: $(NAME).la
49# $(APXS) -i $(NAME).la
50
51.PHONY: install
52install: $(TARGETS)
53 [ -d $(DESTDIR)/etc/httpd/modules ] || \
54 (mkdir -p $(DESTDIR)/$(libdir)/httpd/modules; chmod 755 $(DESTDIR)/$(libdir)/httpd/modules)
55 [ -d $(DESTDIR)/$(sysconfdir)/httpd/conf.d/ ] || \
56 mkdir -p $(DESTDIR)/$(sysconfdir)/httpd/conf.d/; chmod 755 $(DESTDIR)/$(sysconfdir)/httpd/conf.d/;
57 cp .libs/mod_netconf.so $(DESTDIR)/$(libdir)/httpd/modules
58 cp mod_netconf.conf $(DESTDIR)/$(sysconfdir)/httpd/conf.d/
59
60.PHONY: clean
61clean:
62 rm -rf .libs *.la *.lo *.slo test-client
63
64.PHONY: tarball
65tarball: $(SRCS) $(HEADERS)
66 @rm -rf $(NAME)-$(VERSION);
67 @mkdir $(NAME)-$(VERSION);
68 for i in $(SRCS) $(HDRS) mod_netconf.conf README configure.in configure \
69 Makefile.in VERSION $(NAME).spec.in install-sh; do \
70 [ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \
71 cp $$i $(NAME)-$(VERSION)/$$i; \
72 done;
73 @rm -rf $(RPMDIR)/SOURCES/; \
74 mkdir -p $(RPMDIR)/SOURCES/; \
75 tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \
76 $(NAME)-$(VERSION); \
77 rm -rf $(NAME)-$(VERSION);
78
79.PHONY: rpm
80rpm: tarball
81 mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS
82 $(RPMBUILD) -ba $(PKGNAME).spec \
83 --define "_topdir `pwd`/$(RPMDIR)";
84
85.PHONY: distclean
86distclean:
87 rm -rf $(RPMDIR)