1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#
# iniparser Makefile
#
# source files
SRCS = iniparser.c \
dictionary.c
# include rules for platform determination
include platform.mk
# flags for the the various systems
ifeq ($(UNAME), Linux)
# Compiler settings
CC = gcc
AR = ar
ARFLAGS = rcv
SHLD = ${CC} ${CFLAGS}
CFLAGS = -O2 -fPIC -Wall -ansi -pedantic
LDSHFLAGS = -shared -Wl,-Bsymbolic -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
LDFLAGS = -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
endif
ifeq ($(UNAME), Darwin)
# Compiler settings
CC = gcc
# Ar settings to build the library
AR = ar
ARFLAGS = rcv
SHLD = libtool
CFLAGS = -v -arch i386 -fPIC -Wall -ansi -pedantic
LDFLAGS = -arch_only i386
endif
ifeq ($(WIN32), 1)
CC = cl
CFLAGS = //Od //D "_WIN32" //D "WIN32" //D "_CONSOLE" //D "_CRT_SECURE_NO_WARNINGS" //D "_UNICODE" //D "UNICODE" //Gm //EHsc //RTC1 //MDd //W3 //nologo //c //ZI //TC
LDFLAGS = //OUT:"iniparser.lib" //NOLOGO
LINK = lib
RM = rm -f
endif
# windows build rules
ifeq ($(WIN32), 1)
COMPILE.c = $(CC) $(CFLAGS) -c
OBJS = $(SRCS:.c=.obj)
all: iniparser.obj dictionary.obj iniparser.lib
iniparser.obj: dictionary.obj
@($(CC) $(CFLAGS) iniparser.c)
dictionary.obj:
@(echo "compiling dictionary; WIN32: $(WIN32); platform: $(UNAME)")
@($(CC) $(CFLAGS) dictionary.c)
iniparser.lib: dictionary.obj iniparser.obj
@(echo "linking $(OBJS)")
@($(LINK) $(LDFLAGS) $(OBJS))
else
# *nix (and Mac) build rules
RM = rm -f
COMPILE.c = $(CC) $(CFLAGS) -c
OBJS = $(SRCS:.c=.o)
all: libiniparser.a libiniparser.so
.c.o:
@(echo "platform: $(UNAME), WIN32=$(WIN32); compiling $< ...")
@($(COMPILE.c) -o $@ $<)
libiniparser.a: $(OBJS)
@($(AR) $(ARFLAGS) libiniparser.a $(OBJS))
ifeq ($(UNAME), Linux)
libiniparser.so: $(OBJS)
@$(SHLD) $(LDSHFLAGS) -o $@.0 $(OBJS) $(LDFLAGS)
else
libiniparser.so: $(OBJS)
@$(SHLD) -o $@.0 $(LDFLAGS) $(OBJS)
endif
endif
clean:
$(RM) $(OBJS) libiniparser.*
|