Submitted By: Mario Fetka (mario dot fetka at gmail dot com) Date: 2009-05-18 Initial Package Version: changeset cb5655728089 Origin: me Upstream Status: unknown Description: add new install targets and add LDFLAGS diff -Naur tux3.orig/user/Makefile tux3/user/Makefile --- tux3.orig/user/Makefile 2009-05-17 20:13:43.438558904 +0000 +++ tux3/user/Makefile 2009-05-18 05:53:47.299567472 +0000 @@ -11,22 +11,32 @@ CFLAGS += -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers CFLAGS += $(UCFLAGS) +LDFLAGS = + CHECKER = sparse CHECKFLAGS = -D__CHECKER__ -D__CHECK_ENDIAN__ -Wbitwise -Wno-transparent-union CHECKFLAGS += -Wno-decl -Wno-declaration-after-statement VG=valgrind --error-exitcode=200 --leak-check=full +INSTALL = install TESTDIR = . +OWNER = root +GROUP = root -testbin = buffer balloc dleaf ileaf iattr xattr btree dir filemap inode commit -tux3bin = tux3 tux3graph -binaries = $(testbin) $(tux3bin) tux3fuse +DISTDIR = +PREFIX=/usr/local +SBINDIR = $(PREFIX)/sbin +LIBEXECDIR = $(PREFIX)/libexec/tux3 ifeq ($(shell pkg-config fuse && echo found), found) - binaries += tux3fuse + fusebin = tux3fuse endif +testbin = buffer balloc dleaf ileaf iattr xattr btree dir filemap inode commit +tux3bin = tux3 tux3graph +binaries = $(testbin) $(tux3bin) $(fusebin) + tuxdeps = Makefile trace.h kernel/trace.h diskiodeps = diskio.c diskio.h bufferdeps = buffer.c buffer.h diskio.h err.h list.h @@ -53,6 +63,9 @@ tests: test_buffer test_balloc test_commit test_dleaf test_ileaf \ test_btree test_dir test_iattr test_xattr test_filemap test_inode +bin: $(tux3bin) $(fusebin) +testbin: $(testbin) + # standalone and library buffer.o: $(tuxdeps) $(bufferdeps) diskio.o: $(tuxdeps) $(diskiodeps) @@ -93,8 +106,8 @@ $(CHECKER) $(CFLAGS) -Dbuild_$(<:.c=) $(CHECKFLAGS) -c $< endif -$(testbin) $(tux3bin): - $(CC) $(CFLAGS) $^ -o $@ +$(testbin) tux3 tux3grath: + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ test_buffer: buffer $(VG) ./buffer @@ -130,7 +143,7 @@ $(VG) ./commit foodev tux3fuse: utility.o tux3fuse.o - $(CC) $(CFLAGS) $$(pkg-config --cflags fuse) utility.o tux3fuse.c -lfuse -otux3fuse + $(CC) $(CFLAGS) $(LDFLAGS) $$(pkg-config --cflags fuse) utility.o tux3fuse.c -lfuse -otux3fuse ifeq ($(CHECK),1) $(CHECKER) $(CFLAGS) $(CHECKFLAGS) $$(pkg-config --cflags fuse) tux3fuse.c endif @@ -160,3 +173,13 @@ distclean: clean rm -f *.orig kernel/*.orig + +install: install-bin install-test + +install-bin: + $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 755 -d $(DISTDIR)$(SBINDIR) + $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 755 $(tux3bin) $(fusebin) $(DISTDIR)$(SBINDIR) + +install-test: install-bin + $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 755 -d $(DISTDIR)$(LIBEXECDIR) + $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 755 $(testbin) $(DISTDIR)$(LIBEXECDIR)