Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 7635f32

Browse files
committed
Adjust template
1 parent 9819457 commit 7635f32

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

bitlab/Makefile

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
# Compiler
22
CC = gcc
3-
CXX = g++
43

54
# Compiler flags
65
CFLAGS = -std=c11 -Wall -Wextra
7-
CXXFLAGS = -std=c++20 -Wall -Wextra
86

97
# Include directories
108
INCLUDES = -Iinclude
119

1210
# Libraries
1311
CLIBS =
14-
CXXLIBS =
1512

1613
# Source files
1714
CSRCS = $(wildcard src/*.c)
18-
CXXSRCS = $(wildcard src/*.cpp)
1915

2016
# Object files
2117
COBJS = $(CSRCS:.c=.o)
2218
COBJS := $(addprefix build/, $(COBJS))
2319

24-
CXXOBJS = $(CXXSRCS:.cpp=.o)
25-
CXXOBJS := $(addprefix build/, $(CXXOBJS))
26-
2720
# Executable name
2821
MAIN = main
2922

@@ -35,32 +28,20 @@ all: $(MAIN)
3528
@echo "Bitlab has been compiled"
3629

3730
debug: CFLAGS += -g -DDEBUG -D_DEBUG
38-
debug: CXXFLAGS += -g -DDEBUG -D_DEBUG
3931
debug: $(MAIN)
4032
@echo "Bitlab has been compiled in debug mode"
4133

4234
### Choose one of the following for C or C++ compilation -------------------
4335

44-
# $(MAIN): $(COBJS)
45-
# @mkdir -p build/bin
46-
# $(CC) $(CFLAGS) $(INCLUDES) -o build/bin/$(MAIN) $(COBJS) $(CLIBS)
47-
48-
$(MAIN): $(CXXOBJS)
36+
$(MAIN): $(COBJS)
4937
@mkdir -p build/bin
50-
$(CXX) $(CXXFLAGS) $(INCLUDES) -o build/bin/$(MAIN) $(CXXOBJS) $(CXXLIBS)
38+
$(CC) $(CFLAGS) $(INCLUDES) -o build/bin/$(MAIN) $(COBJS) $(CLIBS)
5139

52-
# build/%.o: %.c
53-
# @mkdir -p $(@D)
54-
# $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
55-
56-
build/%.o: %.cpp
40+
build/%.o: %.c
5741
@mkdir -p $(@D)
58-
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
59-
60-
# depend: $(CSRCS)
61-
# makedepend $(INCLUDES) $^
42+
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
6243

63-
depend: $(CXXSRCS)
44+
depend: $(CSRCS)
6445
makedepend $(INCLUDES) $^
6546

6647
### -----------------------------------------------------------------------
@@ -72,4 +53,3 @@ clean:
7253

7354
# Include dependency files
7455
-include $(SRCS:.c=.d)
75-
-include $(SRCS:.cpp=.d)

0 commit comments

Comments
 (0)