aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e7e56c44b2953018c62bd6a7f37248613a3cbfad (plain)
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
include config.mk

OBJ = utils/string.o properties-parser.o properties-lexer.o

CFLAGS  = -DVERSION=${VER}
LFLAGS  = -ll -ly


all: lib${NAME}.a lib${NAME}.so

# Generate the lexer source
properties-lexer.c: properties.l
	${LEX} properties.l
	@mv lex.yy.c properties-lexer.c

# Generate the parser source
properties-parser.h properties-parser.c: properties.y
	${YACC} -d properties.y
	@mv y.tab.c properties-parser.c
	@mv y.tab.h properties-parser.h

.c.o:
	${CC} ${CFLAGS} -c $< -o $@

build_static:
	@make clean ${OBJ}

build_shared:
	@make CFLAGS="${CFLAGS} -fPIC" clean ${OBJ}

lib${NAME}.a: build_static
	${CC} ${OBJ} -o $@ ${LFLAGS}

lib${NAME}.so: build_shared
	${CC} ${OBJ} -o $@ ${LFLAGS}

clean:
	@rm -f ${OBJ} *.core a.out
	@rm -f properties-lexer.c lex.*
	@rm -f properties
	@rm -f properties-parser.* y.*