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 | |
| 9 | prefix = @prefix@ |
| 10 | exec_prefix = @exec_prefix@ |
| 11 | datarootdir = @datarootdir@ |
| 12 | datadir = @datadir@ |
| 13 | bindir = @bindir@ |
| 14 | includedir = @includedir@ |
| 15 | libdir = @libdir@ |
| 16 | mandir = @mandir@ |
| 17 | sysconfdir = @sysconfdir@ |
| 18 | |
| 19 | APXS=/usr/sbin/apxs |
| 20 | |
| 21 | CFLAGS=-I/usr/include/json |
| 22 | LIBS=-lnetconf -ljson |
| 23 | |
| 24 | SRCS=mod_netconf.c \ |
| 25 | test-client.c |
| 26 | |
| 27 | all: module client |
| 28 | |
| 29 | module: mod_netconf.c |
| 30 | $(APXS) $(CPPFLAGS) $(CFLAGS) $(LIBS) -c mod_netconf.c |
| 31 | |
| 32 | client: test-client.c |
| 33 | gcc -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client |
| 34 | |
| 35 | #install: $(NAME).la |
| 36 | # $(APXS) -i $(NAME).la |
| 37 | |
| 38 | .PHONY: install |
| 39 | install: $(TARGETS) |
| 40 | [ -d $(DESTDIR)/etc/httpd/modules ] || \ |
| 41 | (mkdir -p $(DESTDIR)/$(libdir)/httpd/modules; chmod 755 $(DESTDIR)/$(libdir)/httpd/modules) |
| 42 | [ -d $(DESTDIR)/$(sysconfdir)/httpd/conf.d/ ] || \ |
| 43 | mkdir -p $(DESTDIR)/$(sysconfdir)/httpd/conf.d/; chmod 755 $(DESTDIR)/$(sysconfdir)/httpd/conf.d/; |
| 44 | cp .libs/mod_netconf.so $(DESTDIR)/$(libdir)/httpd/modules |
| 45 | cp mod_netconf.conf $(DESTDIR)/$(sysconfdir)/httpd/conf.d/ |
| 46 | |
| 47 | .PHONY: clean |
| 48 | clean: |
| 49 | rm -rf .libs *.la *.lo *.slo test-client |
| 50 | |
| 51 | .PHONY: tarball |
| 52 | tarball: $(SRCS) $(HEADERS) |
| 53 | @rm -rf $(NAME)-$(VERSION); |
| 54 | @mkdir $(NAME)-$(VERSION); |
| 55 | for i in $(SRCS) $(HDRS) mod_netconf.conf README configure.in configure \ |
| 56 | Makefile.in VERSION $(NAME).spec.in install-sh; do \ |
| 57 | [ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \ |
| 58 | cp $$i $(NAME)-$(VERSION)/$$i; \ |
| 59 | done; |
| 60 | @rm -rf $(RPMDIR)/SOURCES/; \ |
| 61 | mkdir -p $(RPMDIR)/SOURCES/; \ |
| 62 | tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \ |
| 63 | $(NAME)-$(VERSION); \ |
| 64 | rm -rf $(NAME)-$(VERSION); |
| 65 | |
| 66 | .PHONY: rpm |
| 67 | rpm: tarball |
| 68 | mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS |
| 69 | $(RPMBUILD) -ba $(PKGNAME).spec \ |
| 70 | --define "_topdir `pwd`/$(RPMDIR)"; |
| 71 | |
| 72 | .PHONY: distclean |
| 73 | distclean: |
| 74 | rm -rf $(RPMDIR) |