-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
35 lines (29 loc) · 941 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
CC?=gcc
CFLAGS=-fPIC -g -c -Wall -std=c99
SRC=src
BLD=build
INC=include
LIB=lib
OBJS=$(BLD)/*.o
INSTALLINC=/usr/include
INSTALLLIB=/lib
INSTALLBIN=/usr/bin
lexer: liblex
$(CC) -olexer -I$(INC)/ $(SRC)/lexer/main.c -L$(LIB)/ -llex -lpcre
liblex:
@mkdir -p $(BLD)
$(CC) $(CFLAGS) -I$(INC)/ -o$(BLD)/tokenizer.o $(SRC)/tokenizer.c
$(CC) $(CFLAGS) -I$(INC)/ -o$(BLD)/token.o $(SRC)/token.c
$(CC) $(CFLAGS) -I$(INC)/ -o$(BLD)/regex.o $(SRC)/regex.c
@mkdir -p $(LIB)
$(CC) -shared -Wl,-soname,$(LIB)/liblex.so.0 -o$(LIB)/liblex.so.0.1.0 $(OBJS)
ln -sf liblex.so.0.1.0 $(LIB)/liblex.so.0
ln -sf liblex.so.0.1.0 $(LIB)/liblex.so
clean:
rm -rf lexer $(LIB) $(BLD)/*.o $(LIB)/*
install:
cp $(LIB)/* $(INSTALLLIB)
ln -sf liblex.so.0.1.0 $(INSTALLLIB)/liblex.so.0
ln -sf liblex.so.0.1.0 $(INSTALLLIB)/liblex.so
cp $(INC)/* $(INSTALLINC)
$(CC) -o$(INSTALLBIN)/lexer -I$(INSTALLINC)/ $(SRC)/lexer/main.c -L$(INSTALLLIB)/ -llex -lpcre