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