-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·56 lines (45 loc) · 1.78 KB
/
Makefile
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
# clear default .SUFFIXES
.SUFFIXES :
#CFLAGS = -time -march=native -O2 -Wall -Wno-unused-local-typedefs -Wno-int-conversion -std=gnu99 -pipe -flto -I /usr/lib/modules/$(shell uname -r)/build/include -I /usr/lib/modules/$(shell uname -r)/build/arch/x86/include
#CFLAGS = -time -march=native -O2 -Wall -Wno-unused-local-typedefs -Wno-int-conversion -std=gnu99 -pipe -flto -I /usr/lib/modules/$(shell uname -r)/build/include -I /usr/lib/modules/$(shell uname -r)/build/arch/x86/include
#CFLAGS = -time -march=native -O2 -Wall -Wno-unused-local-typedefs -Wno-int-conversion -std=gnu99 -pipe -flto -I /usr/lib/modules/$(shell uname -r)/build/include
CFLAGS = -time -march=native -O2 -Wall -Wno-unused-local-typedefs -Wno-int-conversion -std=gnu99 -pipe -flto
CXXFLAGS=$(CFLAGS)
CC = gcc
# RM = del
RM = rm -f
# MV = ren
MV = mv
# CAT = type con
CAT = cat
# MAKEDEP = GCCMAKEDEP
MAKEDEP = makedepend
OBJDIR = obj
SRCDIR = src
OUTDIR = out
DEBUG_SUFFIX = -dbg
TARGET_PROGRAM = keycode-watcher
TARGET = $(OUTDIR)/$(TARGET_PROGRAM)
OBJECTS_LIST = main.o
OBJECTS = $(addprefix $(OBJDIR)/,$(OBJECTS_LIST))
SOURCES = $(patsubst $(OBJDIR)/%.o,$(SRCDIR)/%.c,$(OBJECTS))
LIBS = -lsystemd
DEBUGOBJECTS = $(OBJECTS:.o=$(DEBUG_SUFFIX).o)
DEBUGTARGET = $(TARGET)$(DEBUG_SUFFIX) #$(TARGET:.exe=$(DEBUG_SUFFIX).exe)
DEBUGLIBS = $(LIBS)
$(TARGET) : $(OBJECTS)
mkdir -p $(OUTDIR)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
$(OBJDIR)/%.o : $(SRCDIR)/%.c
mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%$(DEBUG_SUFFIX).o : $(SRCDIR)/%.c
mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -g -c $< -o $@
compile : $(OBJECTS)
debug : $(DEBUGTARGET)
$(DEBUGTARGET) : $(DEBUGOBJECTS)
mkdir -p $(OUTDIR)
$(CC) $(CFLAGS) -o $(DEBUGTARGET) $(DEBUGOBJECTS) $(DEBUGLIBS)
clean :
$(RM) $(OBJECTS) $(TARGET) $(DEBUGOBJECTS) $(DEBUGTARGET)