Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #155 from youpong/cleanup
Browse files Browse the repository at this point in the history
Makefile
  • Loading branch information
TanmayPatil105 authored Jun 7, 2024
2 parents 07d420d + 80aee52 commit b1f4344
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
TARGET = procfetch
TEST_TARGET = test
SRCS = fetch.cpp main.cpp
TESTS = test.cpp fetch.cpp
OBJS = $(SRCS:.cpp=.o)
TEST_OBJS = $(TESTS:.cpp=.o)

CXX = @CXX@
CXXFLAGS = -std=c++17 -Wall -Wextra --pedantic-errors @CXXFLAGS@
LIBS = @LIBS@
LDFLAGS = -pthread

TEST_TARGET = test
TEST_SRCS = test.cpp fetch.cpp
TEST_OBJS = $(TEST_SRCS:.cpp=.o)
TEST_LDFLAGS = $(LDFLAGS) -no-pie

INSTALL = /usr/bin/install -c -D
FORMATTER = clang-format -i
BIN_DIR = @BIN_DIR@

all: $(TARGET)
run: all
./$(TARGET)
build-test: $(TESTS)
$(CXX) $(CXXFLAGS) -c $(TESTS)
$(CXX) $(CXXFLAGS) -o $(TEST_TARGET) $(TEST_OBJS) $(LD_FLAGS) -no-pie
build-test: $(TEST_TARGET)
check: build-test
./$(TEST_TARGET)
gcov:
gcov $(TESTS)
gcov $(TEST_TARGET)
clean:
- rm -f $(TARGET) $(OBJS) $(TEST_TARGET) $(TEST_OBJS) *.gcov *.gcda *.gcno
install: all
Expand All @@ -32,12 +32,14 @@ install: all
uninstall:
- rm "$(BIN_DIR)/$(TARGET)"
format:
$(FORMATTER) $(SRCS) $(TESTS) *.h
$(FORMATTER) $(SRCS) $(TEST_TARGET) *.h

$(TARGET): $(OBJS)
$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
$(TEST_TARGET): $(TEST_OBJS)
$(CXX) -o $@ $(TEST_OBJS) $(LIBS) $(TEST_LDFLAGS)
main.o: fetch.h color.h config.h
fetch.o: fetch.h color.h
test.o: fetch.h color.h

.PHONY: all run check gcov clean docs install uninstall dist format gif
.PHONY: all run check gcov clean docs install uninstall dist format gif build-test

0 comments on commit b1f4344

Please sign in to comment.