Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
74eff33f
Commit
74eff33f
authored
Feb 01, 2010
by
Ramsay Jones
Committed by
Andreas Ericsson
Feb 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makefile: Add support for building with MSVC
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
73dcf287
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
7 deletions
+46
-7
Makefile
+22
-2
tests/Makefile
+24
-5
No files found.
Makefile
View file @
74eff33f
...
...
@@ -18,14 +18,33 @@ libdir=$(prefix)/lib
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo no'
)
ifdef
MSVC
# avoid the MinGW and Cygwin configuration sections
uname_S
:=
Windows
endif
CFLAGS
=
-g
-O2
-Wall
OS
=
unix
EXTRA_SRC
=
EXTRA_OBJ
=
AR_OUT
=
CC_OUT
=
-o
# add a space
# Platform specific tweaks
ifeq
($(uname_S),Windows)
OS
=
win32
RANLIB
=
echo
CC
=
cl
-nologo
AR
=
lib
-nologo
CFLAGS
=
-TC
-W3
-RTC1
-Zi
-DWIN32
-D_DEBUG
-D_LIB
AR_OUT
=
-out
:
CC_OUT
=
-Fo
NO_VISIBILITY
=
YesPlease
endif
ifneq
(,$(findstring
CYGWIN,$(uname_S)))
NO_VISIBILITY
=
YesPlease
endif
...
...
@@ -74,6 +93,7 @@ all:: $(GIT_LIB)
clean
:
rm
-f
$(GIT_LIB)
rm
-f
libgit2.pc
rm
-f
*
.pdb
rm
-f
src/
*
.o src/sha1/
*
.o src/unix/
*
.o src/win32/
*
.o
rm
-rf
apidocs
rm
-f
*
~ src/
*
~ src/git/
*
~ src/sha1/
*
~ src/unix/
*
~ src/win32/
*
~
...
...
@@ -119,12 +139,12 @@ uninstall:
@
rmdir
$(DESTDIR)
/
$(prefix)
/include/git
.c.o
:
$(CC)
$(ALL_CFLAGS)
-c
$<
-o
$@
$(CC)
$(ALL_CFLAGS)
-c
$<
$(CC_OUT)
$@
$(OBJS)
:
$(HDRS)
$(GIT_LIB)
:
$(OBJS)
rm
-f
$(GIT_LIB)
$(AR)
$(GIT_LIB)
$(OBJS)
$(AR)
$(
AR_OUT)$(
GIT_LIB)
$(OBJS)
$(RANLIB)
$(GIT_LIB)
$(TEST_OBJ) $(TEST_EXE) $(TEST_RUN) $(TEST_VAL)
:
$(GIT_LIB)
...
...
tests/Makefile
View file @
74eff33f
...
...
@@ -5,6 +5,11 @@ LD = $(CC)
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo no'
)
ifdef
MSVC
# avoid the MinGW and Cygwin configuration sections
uname_S
:=
Windows
endif
CFLAGS
=
-g
-O2
-Wall
LIBS
=
-L
..
-lgit2
-lz
OS
=
unix
...
...
@@ -15,8 +20,22 @@ CRYPTO_LIB = -lcrypto
EXTRA_LIBS
=
LD_OUT
=
-o
# add a space
CC_OUT
=
-o
# add a space
# Platform specific tweaks
ifeq
($(uname_S),Windows)
CC
=
cl
-nologo
LD
=
link
-nologo
CFLAGS
=
-TC
-W3
-RTC1
-Zi
-DWIN32
-D_DEBUG
-D_LIB
LD_OUT
=
-out
:
CC_OUT
=
-Fo
LIBS
=
..
\\
libgit2.a libz.lib wsock32.lib
CRYPTO_LIB
=
libeay32.lib
endif
ifneq
(,$(findstring
MINGW,$(uname_S)))
OS
=
win32
EXTRA_LIBS
+=
-lwsock32
-lpthread
...
...
@@ -50,7 +69,7 @@ ALL_LIBS = $(LIBS) $(EXTRA_LIBS)
all
::
$(TEST_RUN)
clean
:
rm
-f
*
.o
*
.exe
*
.toc
rm
-f
*
.o
*
.exe
*
.toc
*
.pdb
rm
-rf
trash-
*
.exe
rm
-f
*
~
...
...
@@ -59,7 +78,7 @@ test: $(TEST_RUN)
valgrind
:
$(TEST_VAL)
.c.o
:
$(CC)
$(ALL_CFLAGS)
-c
$<
-o
$@
$(CC)
$(ALL_CFLAGS)
-c
$<
$(CC_OUT)
$@
T_HDR
=
test_lib.h test_helpers.h
T_LIB
=
test_lib.o test_helpers.o
...
...
@@ -73,19 +92,19 @@ $(patsubst %.exe,%.toc,$(TEST_EXE)): %.toc: %.c
mv
$@
+
$@
$(TEST_OBJ)
:
%.o: %.c
$(CC)
$(ALL_CFLAGS)
-c
$<
-o
$@
$(CC)
$(ALL_CFLAGS)
-c
$<
$(CC_OUT)
$@
$(patsubst %.exe,%_main.o,$(TEST_EXE))
:
%_main.o: $(HDRS)
$(patsubst %.exe,%_main.o,$(TEST_EXE))
:
%_main.o: $(T_MAIN_C)
$(patsubst %.exe,%_main.o,$(TEST_EXE))
:
%_main.o: %.toc
$(CC)
$(ALL_CFLAGS)
'-DTEST_TOC="$<"'
\
-c
$(T_MAIN_C)
\
-o
$@
$(CC_OUT)
$@
$(TEST_EXE)
:
%.exe: $(T_LIB)
$(TEST_EXE)
:
%.exe: $(GIT_LIB)
$(TEST_EXE)
:
%.exe: %.o %_main.o
$(LD)
-o
$@
\
$(LD)
$(LD_OUT)
$@
\
$
(
patsubst %.exe,%_main.o,
$@
)
\
$
(
patsubst %.exe,%.o,
$@
)
\
$(T_LIB)
$(ALL_LIBS)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment