summaryrefslogtreecommitdiff
path: root/Makefile
blob: dbe57ca614f7c275ab8781d7a2d95365ba98e426 (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
42
43
44
45
46
47
48
49
all: pgfuse

# for debugging
CFLAGS = -Wall -Werror -g -O0
# for releasing
#CFLAGS = -Wall -O2

# declare version of FUSE API we want to program against
CFLAGS += -DFUSE_USE_VERSION=26

# use pkg-config to detemine compiler/linker flags for libfuse
CFLAGS += `pkg-config fuse --cflags`
LDFLAGS = `pkg-config fuse --libs` -lpq

clean:
	rm -f pgfuse pgfuse.o pgsql.o
	psql < clean.sql

test: pgfuse
	psql < clean.sql
	psql < schema.sql
	-./pgfuse -s -v "" mnt
	mount | grep pgfuse
	# expect success for all
	-mkdir mnt/dir
	-mkdir mnt/dir/dir2
	-mkdir mnt/dir/dir3
	-echo "hello" > mnt/dir/dir2/afile
	-cp Makefile mnt/dir/dir2/bfile
	-cat mnt/dir/dir2/afile
	-ls -al mnt
	-ls -al mnt/dir/dir2
	-rmdir mnt/dir/dir3 
	# expect fail (directory not empty)
	-rmdir mnt/dir
	# expect fail (not a directory)
	-rmdir mnt/dir/dir2/bfile
	# expect success
	-rm mnt/dir/dir2/bfile
	fusermount -u mnt
	
pgfuse: pgfuse.o pgsql.o
	gcc -o pgfuse $(LDFLAGS) pgfuse.o pgsql.o

pgfuse.o: pgfuse.c pgsql.h
	gcc -c $(CFLAGS) -o pgfuse.o pgfuse.c

pgsql.o: pgsql.c pgsql.h
	gcc -c $(CFLAGS) -o pgsql.o pgsql.c