File: Makefile

package info (click to toggle)
mongrel2 1.9.1-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 5,956 kB
  • sloc: ansic: 43,228; python: 2,827; sql: 1,555; makefile: 347; sh: 307; asm: 234; yacc: 145; php: 73; sed: 5
file content (60 lines) | stat: -rw-r--r-- 1,464 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
CFLAGS+=-DNDEBUG -DNO_LINENOS -pthread -g -I../../src -Isrc -Wall $(OPTFLAGS)
LIBS=-lzmq -lsqlite3 ../../build/libm2.a $(OPTLIBS)

PREFIX?=/usr/local
SOURCES=$(wildcard src/*.c src/**/*.c)
OBJECTS=$(patsubst %.c,%.o,${SOURCES})
TEST_SRC=$(wildcard tests/*.c)
TESTS=$(patsubst %.c,%,${TEST_SRC})
LIB_SRC=$(filter-out src/m2sh.c,${SOURCES})
LIB_OBJ=$(filter-out src/m2sh.o,${OBJECTS})

all: ../lemon/lemon tests build/m2sh

dev: CFLAGS=-g -Wall -Wextra -Isrc -I../../src $(OPTFLAGS)
dev: all

install: build/m2sh
	install build/m2sh ${DESTDIR}${PREFIX}/bin

build/libm2sh.a: ${LIB_OBJ}
	mkdir -p build
	ar rcs $@ ${LIB_OBJ}
	ranlib $@

build/m2sh: ../lemon/lemon ../../build/libm2.a ${OBJECTS}
	mkdir -p build
	$(CC) $(CFLAGS) $(LDFLAGS) -o build/m2sh ${OBJECTS} ../../build/libm2.a $(LIBS)

../lemon/lemon: ../lemon/lemon.c
	$(CC) $(CFLAGS) $(LDFLAGS) ../lemon/lemon.c -o ../lemon/lemon

tests: build/libm2sh.a ${TESTS}
	sh ./tests/runtests.sh

%.c: %.y
	../lemon/lemon -s $< 

%.c: %.rl
	ragel -G2 $<

$(TESTS): %: %.c build/libm2sh.a
	$(CC) $(CFLAGS) -o $@ $< build/libm2sh.a ../../build/libm2.a $(LIBS)

../../build/libm2.a:
	cd ../.. && make clean all

clean:
	rm -rf src/*.o src/*/*.o build tests/*_tests tests/*.o

pristine: clean
	rm -f ../lemon/lemon

netbsd: OPTFLAGS=-I/usr/local/include -I/usr/pkg/include
netbsd: OPTLIBS=-L/usr/local/lib -L/usr/pkg/lib
netbsd: dev

freebsd: OPTFLAGS=-I/usr/local/include
freebsd: OPTLIBS=-L/usr/local/lib
freebsd: dev