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