Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 1 | PKGNAME = @PACKAGE_NAME@ |
| 2 | NAME=mod_netconf |
| 3 | VERSION = $(shell cut -f1 ./VERSION | tr -d '\n') |
| 4 | MAJOR_VER = $(shell echo $(VERSION) | cut -d. -f1) |
| 5 | RELEASE = @RELEASE@ |
| 6 | RPMDIR = RPMBUILD |
| 7 | RPMBUILD = @RPMBUILD@ |
| 8 | |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 9 | IDGIT = "built from git $(shell git show --pretty=oneline | head -1 | cut -c -20)" |
| 10 | IDNOGIT = "released as version $(VERSION)" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 11 | prefix = @prefix@ |
| 12 | exec_prefix = @exec_prefix@ |
| 13 | datarootdir = @datarootdir@ |
| 14 | datadir = @datadir@ |
| 15 | bindir = @bindir@ |
| 16 | includedir = @includedir@ |
| 17 | libdir = @libdir@ |
| 18 | mandir = @mandir@ |
| 19 | sysconfdir = @sysconfdir@ |
| 20 | |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 21 | ARCSID = @ARCSID@ |
| 22 | RCSID = @RCSID@ |
| 23 | |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 24 | APXS=/usr/sbin/apxs |
| 25 | |
| 26 | CFLAGS=-I/usr/include/json |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame^] | 27 | CPPFLAGS=@CPPFLAGS@ |
| 28 | LIBS=@LIBS@ |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 29 | |
| 30 | SRCS=mod_netconf.c \ |
| 31 | test-client.c |
| 32 | |
Tomas Cejka | 4ce5d0a | 2013-01-17 19:23:54 +0100 | [diff] [blame] | 33 | HDRS=message_type.h |
| 34 | |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 35 | all: module client |
| 36 | |
| 37 | module: mod_netconf.c |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame^] | 38 | $(APXS) $(LIBS) $(ARCSID) $(CPPFLAGS) -c mod_netconf.c notification-server.c |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 39 | |
| 40 | client: test-client.c |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 41 | gcc $(RCSID) -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 42 | |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame^] | 43 | notification-test: notification-server.c |
| 44 | gcc $(RCSID) -std=gnu99 -Wall -g -lwebsockets -DTEST_NOTIFICATION_SERVER notification-server.c -o notification-test |
| 45 | |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 46 | #install: $(NAME).la |
| 47 | # $(APXS) -i $(NAME).la |
| 48 | |
| 49 | .PHONY: install |
| 50 | install: $(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 |
| 59 | clean: |
| 60 | rm -rf .libs *.la *.lo *.slo test-client |
| 61 | |
| 62 | .PHONY: tarball |
| 63 | tarball: $(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 |
| 78 | rpm: tarball |
| 79 | mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS |
| 80 | $(RPMBUILD) -ba $(PKGNAME).spec \ |
| 81 | --define "_topdir `pwd`/$(RPMDIR)"; |
| 82 | |
| 83 | .PHONY: distclean |
| 84 | distclean: |
| 85 | rm -rf $(RPMDIR) |