Skip to content

Commit fa75643

Browse files
committed
Add makefile
1 parent 422e425 commit fa75643

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ tags
2424
.DS_Store
2525
.directory
2626
*.debug
27-
Makefile*
2827
*.prl
2928
*.app
3029
moc_*.cpp

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# processWatchdog application makefile
3+
# Copyright (c) 2023 Eray Ozturk <[email protected]>
4+
#
5+
CC := gcc
6+
STRIP := strip
7+
8+
TARGET_EXEC := processWatchdog
9+
10+
SRC_DIRS := src
11+
DEPLOY_DIR := .
12+
13+
SRCS := $(shell find $(SRC_DIRS) -not -name 'main.c' -name '*.c')
14+
15+
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
16+
17+
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
18+
19+
WARNING_FLAGS := -pedantic -Wall -Wextra -Wno-missing-declarations -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wformat-security -Wno-discarded-qualifiers -Wno-implicit-fallthrough -Wformat-nonliteral -Wmissing-format-attribute -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -Wno-ignored-qualifiers -Wno-strict-prototypes -Wno-bad-function-cast -Wno-pointer-sign
20+
HARDENING_FLAGS := -fno-builtin -fvisibility=hidden -fstack-protector -fno-omit-frame-pointer -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-common -ffunction-sections -fdata-sections
21+
PERFORMANCE_FLAGS := -fPIC -fPIE -ffast-math -fassociative-math -fno-signed-zeros -fno-trapping-math -fno-exceptions
22+
23+
#debug
24+
#CFLAGS := $(INC_FLAGS) -g3 -o0 -ggdb $(WARNING_FLAGS)
25+
26+
#release
27+
CFLAGS := $(INC_FLAGS) -g0 -o2 $(WARNING_FLAGS) $(HARDENING_FLAGS) $(PERFORMANCE_FLAGS)
28+
29+
LIBS := -lpthread -lm
30+
31+
all: $(TARGET_EXEC)
32+
33+
$(TARGET_EXEC):
34+
$(CC) $(SRCS) $(CFLAGS) $(EXTRA) -o $(DEPLOY_DIR)/$(TARGET_EXEC) $(SRC_DIRS)/main.c $(LIBS)
35+
$(STRIP) -R .comment -R *.note* -s -x -X -v $(DEPLOY_DIR)/$(TARGET_EXEC)
36+
37+
.PHONY: clean
38+
clean:
39+
rm $(TARGET_EXEC)
40+
41+
.PHONY: install
42+
install:
43+
cp $(TARGET_EXEC) ~/
44+
cp run.sh ~/
45+
chmod +x $(TARGET_EXEC) run.sh

0 commit comments

Comments
 (0)