aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
blob: a3481e006309cf3ebb89bc8dee690ed65b9bbee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
SHELL = /bin/sh
VPATH = @srcdir@

subdirs = libssh 
top_srcdir = @top_srcdir@
top_builddir = .
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
incldir= $(prefix)/include
infodir = $(prefix)/info
libdir = $(prefix)/lib
mandir = $(prefix)/share/man
docdir = $(prefix)/share/doc

CC = @CC@
CFLAGS = @CFLAGS@ -Iinclude -Wall 
LDFLAGS = @LDFLAGS@ 
LIBS = -lssh -Llibssh
INSTALL = @INSTALL@
LN = @LN_S@
LIBTOOL = @LIBTOOL@
OBJECTS = sample.o samplesshd.o
APPS = samplessh samplesftp samplesshd
VERSION = 0.2rc
DISTLIB = libssh-$(VERSION)
CONFIG = include/libssh/config.h

.PHONY: all
all: $(CONFIG) SUBDIRS $(OBJECTS) $(APPS)

.PHONY: SUBDIRS
SUBDIRS:
	@for dir in ${subdirs}; do \
	  (cd $$dir && $(MAKE) all) \
	  || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"

% : %.o
	$(LIBTOOL) --mode=link $(CC) -o $@ $< $(LDFLAGS) $(LIBS)

samplessh: sample.o
	$(LIBTOOL) --mode=link $(CC) -o $@ $< $(LDFLAGS) $(LIBS)

samplesftp: samplessh
	$(LN) -f samplessh samplesftp

$(CONFIG):
	$(LN) -f ../../config.h $(CONFIG)

.PHONY: dist
dist:
	rm -fr $(DISTLIB)
	mkdir $(DISTLIB)
	cp Makefile.in configure.in configure config.h.in install-sh \
	ltmain.sh mkinstalldirs config.sub config.guess $(DISTLIB)
	mkdir $(DISTLIB)/libssh
	mkdir $(DISTLIB)/include
	mkdir $(DISTLIB)/include/libssh
	mkdir $(DISTLIB)/doc
	cp libssh/Makefile.in $(DISTLIB)/libssh/
	cp libssh/*.c $(DISTLIB)/libssh/
	cp libssh/libssh.vers $(DISTLIB)/libssh/
	cp include/libssh/libssh.h include/libssh/sftp.h \
	include/libssh/priv.h include/libssh/crypto.h \
	include/libssh/ssh1.h include/libssh/ssh2.h  \
	include/libssh/server.h $(DISTLIB)/include/libssh/
	cp *.c COPYING README AUTHORS CHANGELOG Doxyfile $(DISTLIB)/
	#cp doc/* $(DISTLIB)/doc/
	#docs removed coz they are obsolete
	tar czf $(DISTLIB).tgz $(DISTLIB)/

.PHONY: doc
doc:
	doxygen

.PHONY: install
install: all
	@for dir in ${subdirs}; do \
	  (cd $$dir && $(MAKE) install) \
	  || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(incldir)/libssh
	$(INSTALL) include/libssh/libssh.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/config.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/sftp.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/crypto.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/server.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/ssh2.h $(DESTDIR)$(incldir)/libssh/
	$(INSTALL) include/libssh/ssh1.h $(DESTDIR)$(incldir)/libssh/

.PHONY: install-doc
install-doc: doc
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/libssh/html
	$(INSTALL) doxygen/html/* $(DESTDIR)$(docdir)/libssh/html
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/libssh/examples
	$(INSTALL) sample.c samplesshd.c $(DESTDIR)$(docdir)/libssh/examples
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
	$(INSTALL) doxygen/man/man3/* $(DESTDIR)$(mandir)/man3

.PHONY: clean
clean:
	$(LIBTOOL) --mode=clean rm -f *~ *.o samplessh samplesftp samplesshd include/libssh/config.h
	rm -rf doxygen
	@for dir in ${subdirs}; do \
	  (cd $$dir && $(MAKE) clean) \
	  || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"

.PHONY: distclean
distclean: clean
	@for dir in ${subdirs}; do \
	  (cd $$dir && $(MAKE) distclean) \
	  || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"
	rm -f Makefile config.h config.status config.cache config.log libtool