Skip to content

Commit

Permalink
Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
UO269984 committed Sep 20, 2022
1 parent 4157acb commit 5b3d603
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
*~

cuTest.a
cuTestCPP.a
*.a
*.lib
CuTestTest
CuTestTest.exe

config
bin/
binCpp/
30 changes: 19 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
CC := gcc
CXX := gcc
AR := ar
CFLAGS = -Wall -c -o $@

LIB_EXT := $(if $(filter-out $(OS),Windows_NT),a,lib)
CUTEST_LIB := cuTest.$(LIB_EXT)
CUTEST_CPP_LIB := cuTestCPP.$(LIB_EXT)

EXEC_EXT := $(if $(filter-out $(OS),Windows_NT),,.exe)
TEST_EXEC := CuTestTest$(EXEC_EXT)

.PHONY: all
all: cuTest.a cuTestCPP.a CuTestTest
all: $(CUTEST_LIB) $(CUTEST_CPP_LIB) $(TEST_EXEC)

.PHONY: buildFolders
buildFolders:
mkdir -p bin
mkdir -p binCpp

.PHONY: test
test: CuTestTest
@./CuTestTest
test: $(TEST_EXEC)
@./$(TEST_EXEC)

CuTestTest: bin/AllTests.o bin/CuTestTest.o cuTest.a
$(TEST_EXEC): bin/AllTests.o bin/CuTestTest.o $(CUTEST_LIB)
$(CC) -o $@ $^

cuTest.a: bin/CuTest.o
ar rcs $@ $^
$(CUTEST_LIB): bin/CuTest.o
$(AR) rcs $@ $^

cuTestCPP.a: binCpp/CuTest.o binCpp/CuTestCPP.o
ar rcs $@ $^
$(CUTEST_CPP_LIB): binCpp/CuTest.o binCpp/CuTestCPP.o
$(AR) rcs $@ $^

bin/%.o: %.c
$(CC) $(CFLAGS) $<
Expand All @@ -36,6 +44,6 @@ binCpp/CuTestCPP.o: CuTestCPP.cpp
clean:
rm -f bin/*
rm -f binCpp/*
rm -f cuTest.a
rm -f cuTestCPP.a
rm -f CuTestTest
rm -f $(CUTEST_LIB)
rm -f $(CUTEST_CPP_LIB)
rm -f $(TEST_EXEC)

0 comments on commit 5b3d603

Please sign in to comment.