gitified.
[usmb.git] / Makefile
blobbf9074bafae2349d25c2a98e4be73110f164460f
1 # usmb - mount SMB shares via FUSE and Samba
2 # Copyright (C) 2006-2009 Geoff Johnstone
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 SAMBA = /opt/samba
18 CC = gcc
19 INSTALL = install
21 PREFIX = /usr/local
22 BINDIR = $(PREFIX)/bin
24 CFLAGS += -Wall -Wextra -Werror -std=c99 -pedantic -O \
25 -I$(SAMBA)/include -D_BSD_SOURCE -DFUSE_USE_VERSION=26 \
26 -DHAVE_UTIME_H -DMUSTCHECK='__attribute__ ((warn_unused_result))' \
27 -DUNUSED='__attribute__ ((unused))'
29 LDLIBS = -lsmbclient
30 LDFLAGS = -L$(SAMBA)/lib
32 PACKAGES = glib-2.0 libxml-2.0 fuse
34 CFLAGS += $(shell pkg-config --cflags $(PACKAGES))
35 LDLIBS += $(shell pkg-config --libs-only-l $(PACKAGES))
36 LDFLAGS += $(shell pkg-config --libs-only-L $(PACKAGES))
38 SOURCES = conffile.c options.c password.c usmb.c usmb_dir.c usmb_file.c \
39 utils.c version.c xml.c
40 OBJECTS = $(SOURCES:.c=.o)
42 PROGRAM = usmb
45 all: $(PROGRAM)
47 conffile.c: config.rng.h
48 config.rng.h: config.rng
49 sed -e 's/"/\\"/g' -e 's/\(.*\)/ "\1" \\/' \
50 -e '1istatic const char *rng_$(^:.rng=) =' $^ > config.rng.h
51 echo ' "";' >> config.rng.h
53 debug: CFLAGS += -ggdb -DDEBUG
54 debug: all
57 $(PROGRAM): $(OBJECTS)
58 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
61 clean:
62 $(RM) $(PROGRAM) $(OBJECTS)
65 distclean: clean
66 $(RM) core usmb-*.tar.bz2 usmb-*.tar.gz doc/*.mdzip.bak config.rng.h
69 install-strip: STRIPFLAGS = -s
70 install install-strip: $(PROGRAM)
71 mkdir -p $(BINDIR)
72 $(INSTALL) -m 755 $(STRIPFLAGS) $(PROGRAM) $(BINDIR)/
75 uninstall:
76 $(RM) $(BINDIR)/$(PROGRAM)
77 rmdir -p $(BINDIR)
78 @echo Please delete ~/.usmb.conf manually.
81 dist: tar
83 tar: VERSION=$(shell grep 'USMB_VERSION[^_]' version.h | sed 's/.*0x//')
84 tar: STAGING=/tmp/usmb-$(VERSION)
85 tar:
86 mkdir $(STAGING)
87 git archive $(VERSION) | tar -C $(STAGING) -x -f -
88 git log > $(STAGING)/Changelog
89 hg log -v > $(STAGING)/Changelog
90 cp -a $(PWD)/* $(STAGING)/
91 rm -rf $(STAGING)/.hg
92 (cd $(STAGING)/..; \
93 tar jcf $(PWD)/usmb-$(VERSION).tar.bz2 usmb-$(VERSION) ; \
94 tar zcf $(PWD)/usmb-$(VERSION).tar.gz usmb-$(VERSION))
95 rm -rf $(STAGING)
98 .PHONY: all debug dist install install-strip uninstall clean distclean tar
100 conffile.o: conffile.c utils.h xml.h config.rng.h
101 options.o: options.c options.h utils.h version.h
102 password.o: password.c password.h utils.h
103 usmb.o: usmb.c conffile.h options.h usmb.h usmb_dir.h usmb_file.h utils.h \
104 password.h version.h samba30-compat.h
105 usmb_dir.o: samba30-compat.h usmb_dir.c usmb_dir.h usmb.h utils.h
106 usmb_file.o: samba30-compat.h usmb_file.c usmb_file.h usmb.h utils.h
107 utils.o: utils.c utils.h
108 version.o: version.c version.h
109 xml.o: xml.c xml.h utils.h