]>
Commit | Line | Data |
---|---|---|
847c6793 AS |
1 | PLATFORM=$(shell uname -s) |
2 | ||
3 | ifneq (,$(CROSS_COMPILE)) | |
4 | PREFIX=$(CROSS_COMPILE)- | |
5 | else | |
6 | PREFIX= | |
7 | endif | |
8 | ||
a6837b5f | 9 | MINGW=0 |
847c6793 | 10 | ifneq (,$(findstring MINGW32,$(PLATFORM))) |
a6837b5f | 11 | MINGW=1 |
847c6793 AS |
12 | endif |
13 | ifneq (,$(findstring mingw,$(CROSS_COMPILE))) | |
a6837b5f | 14 | MINGW=1 |
847c6793 | 15 | endif |
e96e3be7 | 16 | |
e1bf24c8 | 17 | rm=rm -f |
847c6793 AS |
18 | AR=$(PREFIX)ar cq |
19 | RANLIB=$(PREFIX)ranlib | |
20 | ||
e1bf24c8 | 21 | LIBNAME=libgit2.a |
847c6793 | 22 | |
a6837b5f | 23 | ifeq ($(MINGW),1) |
e96e3be7 SG |
24 | CC=gcc |
25 | else | |
26 | CC=cc | |
27 | endif | |
e1bf24c8 | 28 | |
847c6793 AS |
29 | CC:=$(PREFIX)$(CC) |
30 | ||
7fcddeb6 | 31 | INCLUDES= -I. -Isrc -Iinclude -Ideps/http-parser -Ideps/zlib |
e1bf24c8 | 32 | |
8e1742ab | 33 | DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $(EXTRA_DEFINES) |
a3c2d916 | 34 | CFLAGS= -g $(DEFINES) -Wall -Wextra -Wno-missing-field-initializers -O2 $(EXTRA_CFLAGS) |
e1bf24c8 | 35 | |
26227474 | 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 |
e96e3be7 | 37 | |
a6837b5f | 38 | ifeq ($(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 | 42 | else |
e905c1fc | 43 | SRCS += $(wildcard src/unix/*.c) |
e96e3be7 SG |
44 | CFLAGS += -fPIC |
45 | endif | |
46 | ||
e1bf24c8 VM |
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) |