File: Makefile

package info (click to toggle)
lua-posix 5.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 104 kB
  • ctags: 150
  • sloc: ansic: 1,144; makefile: 68; sh: 9
file content (96 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
# makefile for POSIX library for Lua

# change these to reflect your Lua installation
PREFIX=		/usr/local
LUAVERSION=	5.1
LUAINC= 	$(PREFIX)/include
LUALIB= 	$(PREFIX)/lib/lua/$(LUAVERSION)
LUABIN= 	$(PREFIX)/bin

# other executables
TAR=		tar
LUA=		lua
INSTALL=	install

# no need to change anything below here
PACKAGE=	luaposix
LIBVERSION=	4
VERSION=	$(LUAVERSION).$(LIBVERSION)

SRCS=		lposix.c modemuncher.c test.lua tree.lua
EXTRADIST=	Makefile README ChangeLog
DISTFILES=	$(SRCS) $(EXTRADIST)
DISTDIR=	$(PACKAGE)-$(VERSION)
TARGZ=		$(PACKAGE)-$(VERSION).tar.gz

CPPFLAGS=	-fPIC $(INCS) $(WARN)
WARN=		-pedantic -Wall
INCS=		-I$(LUAINC)

MYNAME=		posix
MYLIB= 		$(MYNAME)

OBJS=		l$(MYLIB).o

T= 		$(MYLIB).so

OS=$(shell uname)
ifeq ($(OS),Darwin)
  LDFLAGS_SHARED=-bundle -undefined dynamic_lookup
  LIBS=
else
  LDFLAGS_SHARED=-shared
  LIBS=-lcrypt
endif

# targets
phony += all
all:	$T

phony += test
test:	all
	$(LUA) test.lua

$T:	$(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $(OBJS) $(LIBS)

$(OBJS): modemuncher.c

phony += tree
tree:	$T
	$(LUA) -l$(MYNAME) tree.lua .

phony += clean
clean:
	rm -f $(OBJS) $T core core.* a.out $(TARGZ)

phony += install
install: $T
	$(INSTALL) -D $T $(DESTDIR)/$(LUALIB)/$T
	
phony += show-funcs
show-funcs:
	@echo "$(MYNAME) library:"
	@fgrep '/**' l$(MYLIB).c | cut -f2 -d/ | tr -d '*' | sort

# distribution

phony += distdir
distdir: $(DISTFILES)
	if [ -d "$(DISTDIR)" ]; then	\
		rm -r "$(DISTDIR)";	\
	fi
	mkdir "$(DISTDIR)"
	cp -a $(DISTFILES) "$(DISTDIR)/"


phony += tar
tar:	distdir	
	$(TAR) zcf $(TARGZ) $(DISTDIR)
	rm -r $(DISTDIR)

phony += dist
dist:	tar

.PHONY: $(phony)
# eof