summaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: 1e1c3e9f6f992b14aa4b8c7aaf6f49c619f6289e (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
# config
#USE_OPENSSL=1
#USE_GNUTLS=1
srcdir	= .
VPATH	= $(srcdir)
-include Make.config
include $(srcdir)/mk/Variables.mk

ifdef USE_OPENSSL
SSL_DEFS=-DUSE_OPENSSL
pkglst+=openssl
endif

ifdef USE_GNUTLS
SSL_DEFS=-DUSE_GNUTLS
pkglst+=gnutls
endif

CFLAGS	+= -Wall -Wno-pointer-sign
CFLAGS	+= -DVERSION='"$(VERSION)"'
CFLAGS  += $(SSL_DEFS)

TARGETS	:= amtterm amtider
DESKTOP := $(wildcard *.desktop)

all: build

#################################################################
# poor man's autoconf ;-)

include mk/Autoconf.mk

define make-config
LIB		:= $(LIB)
HAVE_GTK	:= $(call ac_pkg_config,gtk+-3.0)
HAVE_GDK	:= $(call ac_pkg_config,gdk-3.0)
HAVE_VTE	:= $(call ac_pkg_config,vte-2.91)
endef

#################################################################

# build gamt?
ifeq ($(HAVE_GTK)$(HAVE_VTE),yesyes)
  TARGETS += gamt
  gamt : CFLAGS += -Wno-strict-prototypes
  gamt : pkglst += gtk+-3.0 gdk-3.0 vte-2.91
endif

CFLAGS += $(shell test "$(pkglst)" != "" && pkg-config --cflags $(pkglst))
LDLIBS += $(shell test "$(pkglst)" != "" && pkg-config --libs   $(pkglst))

#################################################################

build: $(TARGETS)

install: build
	$(INSTALL_DIR) $(bindir) $(appdir) $(mandir)/man1 $(mandir)/man7
	$(INSTALL_BINARY) $(TARGETS) $(bindir)
	$(INSTALL_SCRIPT) amttool $(bindir)
	$(INSTALL_DATA) $(DESKTOP) $(appdir)
	$(INSTALL_DATA) gamt.man $(mandir)/man1/gamt.1
	$(INSTALL_DATA) amtterm.man $(mandir)/man1/amtterm.1
	$(INSTALL_DATA) amttool.man $(mandir)/man1/amttool.1
	$(INSTALL_DATA) amt-howto.man $(mandir)/man7/amt-howto.7

clean:
	rm -f *.o *~
	rm -f $(TARGETS)

distclean: clean
	rm -f Make.config
	rm -f mk/*.dep

#################################################################

amtterm: amtterm.o redir.o tcp.o auth.o ssl.o ider.o
amtider: amtider.o redir.o tcp.o auth.o ssl.o ider.o
gamt: gamt.o redir.o tcp.o parseconfig.o auth.o ssl.o ider.o

#################################################################

include mk/Compile.mk
include mk/Maintainer.mk
-include $(depfiles)