--- Makefile.orig 2012-06-07 04:51:30 UTC +++ Makefile @@ -1,23 +1,21 @@ UNAME = $(shell sh -c 'uname -s 2>/dev/null || echo not') DESTDIR = -PREFIX = /usr/local +PREFIX ?= /usr/local MAJOR = 1 MINOR = 9 REVISION = 6 LIB = libcli.so -CC = gcc -DEBUG = -g -OPTIM = -O3 -CFLAGS += $(DEBUG) $(OPTIM) -Wall -std=c99 -pedantic -Wformat-security -Wno-format-zero-length -Werror -Wwrite-strings -Wformat -fdiagnostics-show-option -Wextra -Wsign-compare -Wcast-align -Wno-unused-parameter +CC ?= gcc +CFLAGS += -Wall -Wformat-security -Wno-format-zero-length -Wwrite-strings -Wformat -fdiagnostics-show-option -Wextra -Wsign-compare -Wcast-align -Wno-unused-parameter LDFLAGS += -shared LIBPATH += -L. ifeq ($(UNAME),Darwin) LDFLAGS += -Wl,-install_name,$(LIB).$(MAJOR).$(MINOR) else -LDFLAGS += -Wl,-soname,$(LIB).$(MAJOR).$(MINOR) +LDFLAGS += -Wl,-soname,$(LIB).$(MAJOR)$(MINOR) LIBS = -lcrypt endif @@ -26,8 +24,9 @@ all: $(LIB) clitest $(LIB): libcli.o $(CC) -o $(LIB).$(MAJOR).$(MINOR).$(REVISION) $^ $(LDFLAGS) $(LIBS) -rm -f $(LIB) $(LIB).$(MAJOR).$(MINOR) - ln -s $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR).$(MINOR) - ln -s $(LIB).$(MAJOR).$(MINOR) $(LIB) + ln -sf $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR).$(MINOR) + ln -sf $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR)$(MINOR) + ln -sf $(LIB).$(MAJOR).$(MINOR) $(LIB) %.o: %.c $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ -c $< @@ -48,8 +47,9 @@ install: $(LIB) install -m 0644 libcli.h $(DESTDIR)$(PREFIX)/include install -m 0755 $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(DESTDIR)$(PREFIX)/lib cd $(DESTDIR)$(PREFIX)/lib && \ - ln -s $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR).$(MINOR) && \ - ln -s $(LIB).$(MAJOR).$(MINOR) $(LIB) + ln -sf $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR).$(MINOR) && \ + ln -sf $(LIB).$(MAJOR).$(MINOR).$(REVISION) $(LIB).$(MAJOR)$(MINOR) && \ + ln -sf $(LIB).$(MAJOR).$(MINOR) $(LIB) rpm: mkdir libcli-$(MAJOR).$(MINOR).$(REVISION)