-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.27 KB
/
Copy pathMakefile
File metadata and controls
53 lines (42 loc) · 1.27 KB
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
# Variables
# (customize if needed)
CC=gcc
CLIENT_FLAGS := -g
DEP_FLAGS := $(shell pkg-config --cflags fuse)
DEP_LIBS := $(shell pkg-config --libs fuse) -lapp
OBJS := dbtoy.o largetext.o xml_format.o
DRIVERLIST = ""
PREFIX=/usr/local
include Makefile.config
ifdef MYSQL_DRV
CLIENT_FLAGS += -DHAVE_MYSQL_DRV $(shell mysql_config --include)
CLIENT_LIBS += $(shell mysql_config --libs)
OBJS += dbtoy_mysql.o
DRIVERLIST += mysql
endif
ifdef POSTGRESQL_DRV
CLIENT_FLAGS += -DHAVE_POSTGRESQL_DRV -I$(shell pg_config --includedir)
CLIENT_LIBS += $(shell pg_config --ldflags) -lpq
OBJS += dbtoy_pgsql.o
DRIVERLIST += postgresql
endif
dbtoy: $(OBJS)
@echo "Building $@ with the following drivers: $(DRIVERLIST)"
@$(CC) -o $@ $(OBJS) $(DEP_LIBS) $(CLIENT_LIBS)
.c.o:
@echo Compiling $<
@$(CC) $(DEP_FLAGS) $(CLIENT_FLAGS) -c $< -o $@
#Dependencies
dbtoy.o: dbtoy.c dbtoy.h xml_format.h largetext.h
dbtoy_mysql.o: dbtoy_mysql.c dbtoy.h largetext.h
dbtoy_pgsql.o: dbtoy_pgsql.c dbtoy.h largetext.h
largetext.o: largetext.c largetext.h
xml_format.o: xml_format.c xml_format.h largetext.h dbtoy.h
.PHONY: clean
Makefile.config:
@echo "*** Makefile.config not found. Please run 'makeall.sh' to generate it."
@exit 1
clean:
rm -f *.o dbtoy
install: dbtoy
install -s dbtoy $(PREFIX)/bin