aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 38d51dc03d110bb6783807faa63a8311eb1bbb33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.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