aboutsummaryrefslogblamecommitdiffstats
path: root/Makefile
blob: 38d51dc03d110bb6783807faa63a8311eb1bbb33 (plain) (tree)














































































































                                                                                           
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OS = linux
# Linux:   linux
# Mac OS:  macos
# Windows: windows
include mk/$(OS).mk


LIB_MAJOR = 1
LIB_MINOR = 0
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = patch


OBJ =\
	libpatch_append_to_patch__.o\
	libpatch_check_file.o\
	libpatch_create_timestamp.o\
	libpatch_create_timestamp_fd.o\
	libpatch_create_timestamp_frac_string.o\
	libpatch_create_timestamp_secs.o\
	libpatch_create_timestamp_stat.o\
	libpatch_create_timestamp_tm.o\
	libpatch_create_timestamp_ts.o\
	libpatch_create_timestamp_tv.o\
	libpatch_create_timestamp_now.o\
	libpatch_fd_diff2_printer__.o\
	libpatch_format_copied_patch.o\
	libpatch_format_ed_alternative_patch.o\
	libpatch_format_ed_patch.o\
	libpatch_format_normal_patch.o\
	libpatch_format_patch.o\
	libpatch_format_rcs_patch.o\
	libpatch_format_unified_patch.o\
	libpatch_get_label_format.o\
	libpatch_get_zu__.o\
	libpatch_guess_format.o\
	libpatch_is_devnull.o\
	libpatch_next_hunk.o\
	libpatch_next_line__.o\
	libpatch_parse_copied_patch.o\
	libpatch_parse_ed_patch.o\
	libpatch_parse_normal_patch.o\
	libpatch_parse_patch.o\
	libpatch_parse_rcs_patch.o\
	libpatch_parse_timestamp.o\
	libpatch_parse_unified_patch.o\
	libpatch_plain_diff2_printer__.o\
	libpatch_plain_fd_diff2_printer.o\
	libpatch_plain_stream_diff2_printer.o\
	libpatch_previous_hunk.o\
	libpatch_reverse_diff2.o\
	libpatch_reverse_hunks__.o\
	libpatch_rewrite_diff2.o\
	libpatch_stream_diff2_printer__.o\
	libpatch_style_requires_text.o

HDR =\
	libpatch.h\
	common.h

LOBJ = $(OBJ:.o=.lo)


all: libpatch.a libpatch.$(LIBEXT)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

.c.lo:
	$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

libpatch.a: $(OBJ)
	@rm -f -- $@
	$(AR) rc $@ $(OBJ)
	$(AR) ts $@ > /dev/null

libpatch.$(LIBEXT): $(LOBJ)
	$(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)

install: libpatch.a libpatch.$(LIBEXT)
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	cp -- libpatch.a "$(DESTDIR)$(PREFIX)/lib/"
	cp -- libpatch.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBMINOREXT)"
	$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBMINOREXT)"
	ln -sf -- libpatch.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBMAJOREXT)"
	ln -sf -- libpatch.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBEXT)"
	cp -- libpatch.h "$(DESTDIR)$(PREFIX)/include/"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libpatch.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBMAJOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBMINOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libpatch.$(LIBEXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/include/libpatch.h"

clean:
	-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib
	-rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT)

.SUFFIXES:
.SUFFIXES: .lo .o .c

.PHONY: all install uninstall clean