8000 Added: Makefile · betterfetch/betterfetch-cpp@d1c5b8b · GitHub
[go: up one dir, main page]

Skip to content

Commit d1c5b8b

Browse files
Added: Makefile
1 parent 31b0e4a commit d1c5b8b

File tree

4 files changed

+55
-12
lines changed

4 files changed

+55
-12
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
/.vscode/*
55

66
build/
7-
build/*
7+
build/*
8+
9+
**/*.o
10+
*.o
11+
*.obj

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CXX = g++
2+
CXXFLAGS = -Wall -Wextra -std=c++17
3+
SRC_DIR = functions
4+
BUILD_DIR = build
5+
6+
SRCS = main.cpp \
7+
$(SRC_DIR)/ascii_show.cpp \
8+
$(SRC_DIR)/get_cpu_info.cpp \
9+
$(SRC_DIR)/get_gpu_info.cpp \
10+
$(SRC_DIR)/get_kernel.cpp \
11+
$(SRC_DIR)/get_memory_info.cpp \
12+
$(SRC_DIR)/get_os_info.cpp \
13+
$(SRC_DIR)/get_shell.cpp \
14+
$(SRC_DIR)/get_up_time.cpp \
15+
$(SRC_DIR)/get_user.cpp
16+
17+
OBJS = $(SRCS:.cpp=.o)
18+
BUILD_OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(OBJS)))
19+
TARGET = $(BUILD_DIR)/betterfetch
20+
21+
all: $(BUILD_DIR) $(TARGET)
22+
23+
$(BUILD_DIR):
24+
mkdir -p $(BUILD_DIR)
25+
26+
$(TARGET): $(BUILD_OBJS)
27+
$(CXX) $(CXXFLAGS) -o $@ $(BUILD_OBJS)
28+
29+
$(BUILD_DIR)/%.o: %.cpp
30+
$(CXX) $(CXXFLAGS) -c $< -o $@
31+
32+
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
33+
$(CXX) $(CXXFLAGS) -c $< -o $@
34+
35+
clean:
36+
rm -rf $(BUILD_DIR)
37+
38+
.PHONY: all clean

functions/ascii_show.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ void displayAsciiArt(const std::string &filename) {
1616
file.close();
1717
}
1818

19-
// DONE! displayAsciiArt works!
19+
// // DONE! displayAsciiArt works!

functions/load.hpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#include <iostream>
2-
#include "get_cpu_info.cpp"
3-
#include "ascii_show.cpp"
4-
#include "get_os_info.cpp"
5-
#include "get_memory_info.cpp"
6-
#include "get_gpu_info.cpp"
7-
#include "get_up_time.cpp"
8-
#include "get_kernel.cpp"
9-
#include "get_user.cpp"
10-
#include "get_shell.cpp"
1+
#pragma once
2+
#include <string>
3+
void displayAsciiArt(const std::string& filename);
4+
std::string getUserName();
5+
std::string getOSInfo();
6+
std::string getKernelVersion();
7+
std::string getCPUInfo();
8+
std::string getShell();
9+
std::string getMemoryInfo();
10+
std::string getGPUInfo();
11+
std::string getUptime();

0 commit comments

Comments
 (0)
0