-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
89 lines (71 loc) · 2.38 KB
/
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
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
# Copyright (C) 2013, 2014 Movsunov A.N.
#
# This file is part of SQLFuse
#
# SQLFuse is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SQLFuse is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SQLFuse. If not, see <http://www.gnu.org/licenses/>.
PROGRAM := sqlfuse
CC := gcc
YACC := bison -dvl
LEX := flex -L
MODULES := .
SRC_FILES := main.c
OBJ_FILES := main.o
# KEYCONF
KC_PREFIX := ./conf/
KC_FILES := keyconf.c keyconf.h
KC_OBJS := keyconf.o
SRC_FILES += $(addprefix $(KC_PREFIX), $(KC_FILES))
OBJ_FILES += $(addprefix $(KC_PREFIX), $(KC_OBJS))
MODULES += conf
# MSSQL
MSSQL_PREFIX := ./mssql/
MSSQL_FILES := msctx.c tsqlcheck.c exec.c table.c util.c mssql.c
MSSQL_GEN_FILES := tsql.tab.c tsql.parser.c tsql.tab.h tsql.parser.h
MSSQL_OBJS := tsql.tab.o tsql.parser.o msctx.o tsqlcheck.o
MSSQL_OBJS += exec.o table.o util.o mssql.o
SRC_FILES += $(addprefix $(MSSQL_PREFIX), $(MSSQL_FILES))
OBJ_FILES += $(addprefix $(MSSQL_PREFIX), $(MSSQL_OBJS))
MODULES += mssql
CFLAGS += -g -lsybdb $(shell pkg-config --cflags glib-2.0 fuse) -I.
LDFLAGS += -g
LIBS += -lsybdb $(shell pkg-config --libs glib-2.0 fuse)
SRC_DIRS := $(MODULES)
VPATH := $(SRC_DIRS)
all: $(PROGRAM)
debug: CC += -DSQLDEBUG
debug: $(PROGRAM)
clean:
rm -f $(PROGRAM)
rm -f $(OBJ_FILES)
rm -f $(addprefix $(MSSQL_PREFIX), $(MSSQL_GEN_FILES) *~)
rm -f $(addprefix $(KC_PREFIX), $(KC_OBJS) *~)
rm -f *~
rm -f *.d *.output
install:
install ./$(PROGRAM) /usr/bin
uninstall:
rm -rf /usr/bin/$(PROGRAM)
$(PROGRAM): $(OBJ_FILES)
$(CC) $^ -o $@ $(LIBS) -pipe
main.o: main.c
$(CC) $< -c $(CFLAGS) $(LDFLAGS) $(LIBS) -MD
# MSSQL
mssql/tsql.%.o: tsql.%.c
$(CC) $< -c -o $@ -pipe
mssql/tsql.parser.c: tsql.l
$(LEX) --outfile=$(addprefix $(MSSQL_PREFIX), tsql.parser.c) --header-file=$(addprefix $(MSSQL_PREFIX), tsql.parser.h) $<
mssql/tsql.tab.c: tsql.y
$(YACC) $<
@mv tsql.tab.c $(addprefix $(MSSQL_PREFIX), tsql.tab.c)
@mv tsql.tab.h $(addprefix $(MSSQL_PREFIX), tsql.tab.h)