summaryrefslogtreecommitdiff
path: root/Makefile
blob: 281910dc095135b556c408ac2b2dba6f2d7235ed (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
#
# vchat-client - alpha version
#

##############################################
# configuration                              #
##############################################

OBJS = vchat-client.o vchat-ui.o vchat-protocol.o vchat-user.o vchat-commands.o vchat-tls.o vchat-connection.o

LIBS = -lncurses
LIBS += -lreadline

CFLAGS = -Wall -Os

## use this line when you've got an readline before 4.(x|2)
#CFLAGS += -DOLDREADLINE
CFLAGS += $(OLDREADLINE)

##### Enable this for using the OpenSSL library
CFLAGS += -DTLS_LIB_OPENSSL -I"/usr/local/opt/openssl@1.1/include"
LIBS += -lssl -lcrypto

##### Enable this for using the mbedTLS library
#CFLAGS += -DTLS_LIB_MBEDTLS
#LIBS += -lmbedx509 -lmbedtls -lmbedcrypto

## you might need one or more of these:
#CFLAGS+= -Wextra -Wall -g -ggdb
#CFLAGS+= -arch x86_64 -Wno-deprecated-declarations
#CFLAGS+= -arch i386 -Wno-deprecated-declarations
#CFLAGS += -I/usr/local/ssl/include -L/usr/local/ssl/lib
#CFLAGS += -I/usr/local/include -L/usr/local/lib
#CFLAGS += -I/usr/pkg/include -L/usr/pkg/lib
#LDFLAGS += -L"/usr/local/opt/openssl@1.1/lib"
#CFLAGS += -I../readline-6.3
#LIBS += ../readline-6.3/libreadline.a

## enable dietlibc
#CC = diet cc
#CFLAGS += -static

## enable debug code
#CFLAGS += -DDEBUG

## the install prefix best is /usr/local
PREFIX=/usr/local


##############################################
# general targets                            #
##############################################


all: vchat-client #vchat-client.1

install: vchat-client vchat-keygen vchatrc.ex
	install -d $(DESTDIR)/etc
	install -d $(DESTDIR)$(PREFIX)/bin
	install -d $(DESTDIR)$(PREFIX)/share/man/man1
	install -m 0755 ./vchat-client $(DESTDIR)$(PREFIX)/bin
	install -m 0755 ./vchat-keygen $(DESTDIR)$(PREFIX)/bin
#	install -m 0644 ./vchat-client.1 $(DESTDIR)$(PREFIX)/share/man/man1
	install -m 0644 ./vchatrc.ex $(DESTDIR)/etc/vchatrc

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/vchat-client
	rm -f $(DESTDIR)$(PREFIX)/bin/vchat-keygen
	rm -f $(DESTDIR)$(PREFIX)/share/man/man1/vchat-client.1
	rm -f $(DESTDIR)/etc/vchatrc


clean:
	rm -f .\#* debian/*~ *~ .*~ *.o vchat-client core *.strace \
	*.ltrace vchat.err vchat.debug* vchat-client.1 manpage.*


##############################################
# compile targets                            #
##############################################

vchat-client: $(OBJS)
	$(CC) $(CFLAGS) -o vchat-client $(OBJS) $(LIBS) $(LDFLAGS)

vchat-client.o: vchat-client.c vchat-config.h Makefile
	$(CC) $(CFLAGS) -o vchat-client.o -c vchat-client.c

vchat-ui.o: vchat-ui.c vchat.h
	$(CC) $(CFLAGS) -o vchat-ui.o -c vchat-ui.c

vchat-protocol.o: vchat-protocol.c vchat-messages.h vchat.h Makefile
	$(CC) $(CFLAGS) -o vchat-protocol.o -c vchat-protocol.c

vchat-user.o: vchat-user.c vchat.h
	$(CC) $(CFLAGS) -o vchat-user.o -c vchat-user.c

vchat-commands.o: vchat-commands.c vchat.h vchat-config.h
	$(CC) $(CFLAGS) -o vchat-commands.o -c vchat-commands.c

vchat-tls.o: vchat-tls.c vchat-tls.h
	$(CC) $(CFLAGS) -o vchat-tls.o -c vchat-tls.c

vchat-connection.o: vchat-connection.c vchat-connection.h
	$(CC) $(CFLAGS) -o vchat-connection.o -c vchat-connection.c

#vchat-client.1: vchat-client.sgml
#	docbook2man vchat-client.sgml