libelf/Makefile
Chris Webb b3ab1bd9a4 Add maintainer update script
This script captures my process for merging changes from new upstream
elfutils releases. It isn't obfuscated for portability as it is only
intended for maintainer use and documentation.
2024-07-18 10:48:35 +01:00

53 lines
1.3 KiB
Makefile

INCDIR = $(PREFIX)/include
LIBDIR = $(PREFIX)/lib
CFLAGS = -O2 -Wall
LDFLAGS =
LDLIBS = -lz -lzstd
MAJOR = 1
MINOR = 0.191
HEADERS = $(wildcard include/*.h src/*.h)
SOURCES = $(wildcard src/*.c)
LIBOBJS = $(patsubst %.c,%.o,$(SOURCES))
PICOBJS = $(patsubst %.c,%.os,$(SOURCES))
override CFLAGS += -DHAVE_CONFIG_H -Iinclude -Isrc
all: libelf.a libelf.so
clean:
rm -f src/*.o src/*.os libelf.a libelf.so
libelf.a: $(LIBOBJS) Makefile
$(AR) rcs $@ $(LIBOBJS)
libelf.so: $(PICOBJS) Makefile
$(CC) $(LDFLAGS) -shared -Wl,-soname,libelf.so.$(MAJOR) \
-o $@ $(PICOBJS) $(LDLIBS)
%.o:: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) -c -o $@ $<
%.os:: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) -fPIC -c -o $@ $<
install: install-headers install-static install-shared
install-headers: include/*.h
mkdir -p $(DESTDIR)$(INCDIR)
install -m 0644 include/*.h $(DESTDIR)$(INCDIR)
install-static: libelf.a install-headers
mkdir -p $(DESTDIR)$(LIBDIR)
install -m 0644 $< $(DESTDIR)$(LIBDIR)
install-shared: libelf.so install-headers
mkdir -p $(DESTDIR)$(LIBDIR)
install $< $(DESTDIR)$(LIBDIR)/libelf.so.$(MAJOR).$(MINOR)
ln -f -s libelf.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libelf.so.$(MAJOR)
ln -f -s libelf.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libelf.so
.PHONY: all clean install install-*