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