-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
88 lines (62 loc) · 1.61 KB
/
Makefile
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
86
87
88
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
LUA_HOME= /usr/local
LUA_INC= $(LUA_HOME)/include
LUA_LIB= $(LUA_HOME)/lib
LUA_BIN= $(LUA_HOME)/bin
# Your platform. See PLATS for possible values.
PLAT= none
CC= gcc
CFLAGS= -O2 -Wall -I$(LUA_INC) $(MYCFLAGS)
LDFLAGS= -L$(LUA_LIB) $(MYLDFLAGS)
LIBS= $(MYLIBS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= linux solaris macosx
LIBNAME= vararg
OBJ= vararg.o
LIB= lib$(LIBNAME).a
SO= lib$(LIBNAME).so
default: $(PLAT)
all: a so
o: $(OBJ)
a: $(LIB)
so: $(SO)
# Static Libraies
$(LIB): $(OBJ)
$(AR) $@ $?
$(RANLIB) $@
# Dynamic Libraies
$(SO): $(OBJ)
$(LD) $(LDFLAGS) -o $@ $?
clean:
$(RM) $(OBJ) $(LIB) $(SO)
echo:
@echo "CC = $(CC)"
@echo "CFLAGS = $(CFLAGS)"
@echo "AR = $(AR)"
@echo "RANLIB = $(RANLIB)"
@echo "RM = $(RM)"
@echo "MYCFLAGS = $(MYCFLAGS)"
@echo "MYLDFLAGS = $(MYLDFLAGS)"
@echo "MYLIBS = $(MYLIBS)"
# Convenience targets for usual platforms
ALL= all
none:
@echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
@echo " $(PLATS)"
linux:
$(MAKE) $(ALL) LD="gcc" MYCFLAGS="-fpic $(MYCFLAGS)" \
MYLDFLAGS="-Wl,-E -O -shared $(MYLDFLAGS)"
solaris:
$(MAKE) $(ALL) LD="gcc" MYCFLAGS="-fpic $(MYCFLAGS)" \
MYLDFLAGS="-O -shared $(MYLDFLAGS)"
macosx:
$(MAKE) $(ALL) MYCFLAGS="-fno-common $(MYCFLAGS)" \
MYLDFLAGS="-bundle -undefined dynamic_lookup $(MYLDFLAGS)" \
LD='export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc'
# (end of Makefile)