-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
99 lines (71 loc) · 2.31 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
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
# Makefile for Go Testing Project
# Variables
GO := go
## Default target: Run tests
all: check
build:
@echo "Building and running project..."
$(GO) build -o gash go-src/gash.go && ./gash
## Run tests
check:
@echo "Running tests..."
cd go-src/shell/ && $(GO) test -v ./
## Clean the project
clean:
@echo "Cleaning up..."
$(GO) clean -testcache
rm -rvf gash
## Help command to show available targets
help:
@echo "Makefile for Go testing project"
@echo
@echo "Available targets:"
@echo " make Run tests (default)"
@echo " make check Run tests"
@echo " make clean Clean test cache"
@echo " make help Show this help message"
# TARGET_EXEC ?= myprogram
# TARGET_TEST ?= test-lab
# BUILD_DIR ?= build
# TEST_DIR ?= tests
# SRC_DIR ?= src
# EXE_DIR ?= app
# SRCS := $(shell find $(SRC_DIR) -name *.c)
# OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
# DEPS := $(OBJS:.o=.d)
# TEST_SRCS := $(shell find $(TEST_DIR) -name *.c)
# TEST_OBJS := $(TEST_SRCS:%=$(BUILD_DIR)/%.o)
# TEST_DEPS := $(TEST_OBJS:.o=.d)
# EXE_SRCS := $(shell find $(EXE_DIR) -name *.c)
# EXE_OBJS := $(EXE_SRCS:%=$(BUILD_DIR)/%.o)
# EXE_DEPS := $(EXE_OBJS:.o=.d)
# CFLAGS ?= -Wall -Wextra -MMD -MP
# DEBUG ?= -g
# SANATIZE ?= -fno-omit-frame-pointer -fsanitize=address
# #If you need to link against a library uncomment the line below and add the library name
# #LDFLAGS ?= -pthread -lreadline
# #Default to building without debug flags
# all: $(TARGET_EXEC) $(TARGET_TEST)
# #Build with debug flags and address sanitizer
# #https://www.gnu.org/software/make/manual/make.html#Target_002dspecific
# debug: CFLAGS += $(SANATIZE)
# debug: CFLAGS += $(DEBUG)
# debug: $(TARGET_EXEC) $(TARGET_TEST)
# $(TARGET_EXEC): $(OBJS) $(EXE_OBJS)
# $(CC) $(CFLAGS) $(OBJS) $(EXE_OBJS) -o $@ $(LDFLAGS)
# $(TARGET_TEST): $(OBJS) $(TEST_OBJS)
# $(CC) $(CFLAGS) $(OBJS) $(TEST_OBJS) -o $@ $(LDFLAGS)
# $(BUILD_DIR)/%.c.o: %.c
# mkdir -p $(dir $@)
# $(CC) $(CFLAGS) -c $< -o $@
# check: $(TARGET_TEST)
# ASAN_OPTIONS=detect_leaks=1 ./$<
# .PHONY: clean
# clean:
# $(RM) -rf $(BUILD_DIR) $(TARGET_EXEC) $(TARGET_TEST)
# # Install the libs needed to use git send-email on codespaces
# .PHONY: install-deps
# install-deps:
# sudo apt-get update -y
# sudo apt-get install -y libio-socket-ssl-perl libmime-tools-perl
# -include $(DEPS) $(TEST_DEPS) $(EXE_DEPS)