forked from benpop/lua-int64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 733 Bytes
/
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
SHELL = /bin/sh
UNAME = $(shell uname -s | tr '[A-Z]' '[a-z]')
ifeq ($(UNAME), darwin)
# Mac OS X
CC ?= clang
DLLFLAGS ?= -bundle -undefined dynamic_lookup
else
# assume Linux
CC ?= gcc
DLLFLAGS ?= -shared
endif
RM ?= rm -f
AR = ar rcu
RANLIB = ranlib
LUADIR ?= /usr/include
COPT ?= -O2
CVERSION ?= -std=c99
CWARN ?= -Wall -Wextra
CFLAGS = $(COPT) $(CVERSION) $(CWARN) -I$(LUADIR) -fPIC $(MYFLAGS)
HDR = int64.h
SRC = int64.c
OBJ = int64.o
DLL = int64.so
LIB = libint64.a
all: dll lib
dll: $(DLL)
lib: $(LIB)
clean:
$(RM) $(OBJ) $(DLL) $(LIB)
$(DLL): $(OBJ) $(MYOBJ)
$(CC) $(DLLFLAGS) -o $@ $^
$(LIB): $(OBJ) $(MYOBJ)
$(AR) $@ $^
$(RANLIB) $@
$(OBJ): $(SRC) $(MYSRC) $(HDR)
$(CC) $(CFLAGS) -c -o $@ $(SRC) $(MYSRC)