summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: aef5400ab8238e3ae4db6e1666314d25552eb294 (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
#****************************************************************************
#
# Makefile for rtwt.
# Vianney Bouchaud.
#
# This is a GNU make (gmake) makefile
#****************************************************************************

# DEBUG can be set to YES to include debugging info, or NO otherwise
DEBUG          	:= NO

#****************************************************************************

CC     := gcc
CXX    := clang++
LD     := clang++
AR     := ar rc
RANLIB := ranlib

DEBUG_CFLAGS     := -g -DDEBUG -fPIC
RELEASE_CFLAGS	 := -Wall -W -Wextra -Wno-unknown-pragmas -Wno-format -O3

LIBS		 := -L/usr/X11R6/lib -lXtst -lX11

DEBUG_CXXFLAGS   := ${DEBUG_CFLAGS}
RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}

DEBUG_LDFLAGS    := -g
RELEASE_LDFLAGS  :=

ifeq (YES, ${DEBUG})
   CFLAGS       := ${DEBUG_CFLAGS}
   CXXFLAGS     := ${DEBUG_CXXFLAGS}
   LDFLAGS      := ${DEBUG_LDFLAGS}
else
   CFLAGS       := ${RELEASE_CFLAGS}
   CXXFLAGS     := ${RELEASE_CXXFLAGS}
   LDFLAGS      := ${RELEASE_LDFLAGS}
endif

#****************************************************************************
# Include paths
#****************************************************************************

INCS := -I./includes/

#****************************************************************************
# Makefile code common to all platforms
#****************************************************************************

CFLAGS   := ${CFLAGS}   ${DEFS}
CXXFLAGS := ${CXXFLAGS} ${DEFS}

#****************************************************************************
# Source files
#****************************************************************************

SRCS := srcs/main.cpp		\
	srcs/Keylogger.cpp

OBJS := $(addsuffix .o,$(basename ${SRCS}))

#****************************************************************************
# Name
#****************************************************************************

OUTPUT := keylogger-X11

#****************************************************************************
# Targets of the build
#****************************************************************************

all: ${OUTPUT}

#****************************************************************************
# Output
#****************************************************************************

${OUTPUT}: ${OBJS}
	${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS}

#****************************************************************************
# common rules
#****************************************************************************

# Rules for compiling source files to object files
%.o : %.cpp
	${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@

%.o : %.c
	${CC} -c ${CFLAGS} ${INCS} $< -o $@

dist:
	bash makedistlinux

clean:
	-rm -f core ${OBJS} ${OUTPUT}

depend:
#makedepend ${INCS} ${SRCS}

#****************************************************************************
# epitech rules
#****************************************************************************

re: clean all