]> git.proxmox.com Git - libgit2.git/blame - Makefile.embed
Merge pull request #2612 from ethomson/warnings
[libgit2.git] / Makefile.embed
CommitLineData
847c6793
AS
1PLATFORM=$(shell uname -s)
2
3ifneq (,$(CROSS_COMPILE))
4 PREFIX=$(CROSS_COMPILE)-
5else
6 PREFIX=
7endif
8
a6837b5f 9MINGW=0
847c6793 10ifneq (,$(findstring MINGW32,$(PLATFORM)))
a6837b5f 11 MINGW=1
847c6793
AS
12endif
13ifneq (,$(findstring mingw,$(CROSS_COMPILE)))
a6837b5f 14 MINGW=1
847c6793 15endif
e96e3be7 16
e1bf24c8 17rm=rm -f
847c6793
AS
18AR=$(PREFIX)ar cq
19RANLIB=$(PREFIX)ranlib
20
e1bf24c8 21LIBNAME=libgit2.a
847c6793 22
a6837b5f 23ifeq ($(MINGW),1)
e96e3be7
SG
24 CC=gcc
25else
26 CC=cc
27endif
e1bf24c8 28
847c6793
AS
29CC:=$(PREFIX)$(CC)
30
7fcddeb6 31INCLUDES= -I. -Isrc -Iinclude -Ideps/http-parser -Ideps/zlib
e1bf24c8 32
8e1742ab 33DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $(EXTRA_DEFINES)
a3c2d916 34CFLAGS= -g $(DEFINES) -Wall -Wextra -Wno-missing-field-initializers -O2 $(EXTRA_CFLAGS)
e1bf24c8 35
26227474 36SRCS = $(wildcard src/*.c) $(wildcard src/transports/*.c) $(wildcard src/xdiff/*.c) $(wildcard deps/http-parser/*.c) $(wildcard deps/zlib/*.c) src/hash/hash_generic.c
e96e3be7 37
a6837b5f 38ifeq ($(MINGW),1)
e905c1fc 39 SRCS += $(wildcard src/win32/*.c) $(wildcard src/compat/*.c) deps/regex/regex.c
e96e3be7 40 INCLUDES += -Ideps/regex
a6837b5f 41 DEFINES += -DWIN32 -D_WIN32_WINNT=0x0501 -D__USE_MINGW_ANSI_STDIO=1
e96e3be7 42else
e905c1fc 43 SRCS += $(wildcard src/unix/*.c)
e96e3be7
SG
44 CFLAGS += -fPIC
45endif
46
e1bf24c8
VM
47OBJS = $(patsubst %.c,%.o,$(SRCS))
48
49%.c.o:
50 $(CC) $(CFLAGS) -c $*.c
51
52all: $(LIBNAME)
53
54$(LIBNAME): $(OBJS)
55 $(rm) $@
56 $(AR) $@ $(OBJS)
57 $(RANLIB) $@
58
59clean:
60 $(rm) $(OBJS) $(LIBNAME)