Edited .gitignore and Makefile to support building BUSE as a shared library.

This commit is contained in:
Adam Cozzette 2011-10-09 23:49:22 -07:00
parent 3b18f42311
commit 9a9d2f7325
2 changed files with 18 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp
*.o
*.so
busexmp

View File

@ -1,18 +1,26 @@
TARGET := busexmp
OBJS := $(TARGET:=.o) buse.o
TARGET := busexmp
LIBOBJS := buse.o
OBJS := $(TARGET:=.o) $(LIBOBJS)
SHAREDLIB := libbuse.so
C := /usr/bin/gcc
CFLAGS := -g -pedantic -Wall -Wextra -std=c99 -I$(HOME)/local/include -I$(HOME)/src/nbd
LDFLAGS :=
CC := /usr/bin/gcc
CFLAGS := -g -pedantic -Wall -Wextra -std=c99 -I$(HOME)/local/include -I$(HOME)/src/nbd
LDFLAGS := -lbuse -L.
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
$(TARGET): %: %.o lib
$(CC) $(LDFLAGS) -o $@ $<
$(OBJS): %.o: %.c buse.h
$(TARGET:=.o): %.o: %.c buse.h
$(CC) $(CFLAGS) -o $@ -c $<
lib: $(LIBOBJS)
$(CC) -shared -fPIC -o $(SHAREDLIB) $^
$(LIBOBJS): %.o: %.c
$(CC) $(CFLAGS) -fPIC -o $@ -c $<
clean:
rm -f $(TARGET) $(OBJS)
rm -f $(TARGET) $(OBJS) $(SHAREDLIB)