blob: a385ec21de42d3a814f81606a65795919ba0fda5 [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
9prefix = @prefix@
10exec_prefix = @exec_prefix@
11datarootdir = @datarootdir@
12datadir = @datadir@
13bindir = @bindir@
14includedir = @includedir@
15libdir = @libdir@
16mandir = @mandir@
17sysconfdir = @sysconfdir@
18
19APXS=/usr/sbin/apxs
20
21CFLAGS=-I/usr/include/json
22LIBS=-lnetconf -ljson
23
24SRCS=mod_netconf.c \
25 test-client.c
26
27all: module client
28
29module: mod_netconf.c
30 $(APXS) $(CPPFLAGS) $(CFLAGS) $(LIBS) -c mod_netconf.c
31
32client: 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
39install: $(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
48clean:
49 rm -rf .libs *.la *.lo *.slo test-client
50
51.PHONY: tarball
52tarball: $(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
67rpm: tarball
68 mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS
69 $(RPMBUILD) -ba $(PKGNAME).spec \
70 --define "_topdir `pwd`/$(RPMDIR)";
71
72.PHONY: distclean
73distclean:
74 rm -rf $(RPMDIR)