File: Makefile

package info (click to toggle)
pecomato 0.0.15-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,116 kB
  • ctags: 1,324
  • sloc: ansic: 5,475; perl: 4,514; sh: 1,934; python: 1,271; makefile: 181
file content (228 lines) | stat: -rw-r--r-- 6,971 bytes parent folder | download | duplicates (3)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
include Makefile.linux.inc
include doc/Makefile.inc

CC		?= gcc
CFLAGS	?= -O2 -fomit-frame-pointer -ansi -pedantic -Wall -W
#CFLAGS	?= -g -pipe -ansi -pedantic -Wall -W
CFLAGS  += -D_GNU_SOURCE -DOS_UNIX -DOS_LINUX -DPRODUCT_ID="\"$(PRODUCT)\"" -DPRODUCT_VERSION="\"$(VERSION)\""
LFLAGS  =
LDFLAGS ?= $(LFLAGS)
PREFIX	?= $(shell pwd)/dist-linux

BIN_DIR	   = $(PREFIX)/bin
DATA_DIR   = $(PREFIX)/share
DOC_DIR    = $(DATA_DIR)/doc/$(PRODUCT)
SRC_PREFIX = $(shell pwd)/dist-src

TARGET	 = $(PRODUCT)
OBJECTS	 = main.o util.o exif.o iptc.o jfif.o adobe.o tiff.o
DOC_DEFS = doc/Makefile.defs


default: all

syst:
	echo "linux system: $(SYST) ($(SYSTBASE))"

all: $(TARGET)

full: clean all

deps: $(OBJECTS)

doc: make-defs
	$(MAKE) -C doc/ -f Makefile.posix all

$(TARGET): deps
	$(CC) $(LDFLAGS) -o $@ $(OBJECTS)

%.o: %.c %.h config.h
	$(CC) $(CFLAGS) -c -o $@ $<

install: all install-dirs install-data install-bin

install-strip: install
	strip $(BIN_DIR)/$(TARGET)

install-dirs:
	$(CHECK_EXIST_DIR) $(BIN_DIR) || \
		$(CREATE_DIR) $(BIN_DIR)
	$(CHECK_EXIST_DIR) $(DOC_DIR) || \
		$(CREATE_DIR) $(DOC_DIR)

install-data: install-doc

install-doc: make-defs
	$(MAKE) -C doc/ -f Makefile.posix install

install-bin: $(TARGET)
	$(COPY_FILE) $(TARGET) $(BIN_DIR)/

uninstall: uninstall-bin uninstall-data uninstall-dirs

uninstall-bin:
	-$(DEL_FILE) $(BIN_DIR)/$(TARGET)

uninstall-data: uninstall-doc

uninstall-doc: make-defs
	-$(MAKE) -C doc/ -f Makefile.posix uninstall

uninstall-dirs:
	-$(DEL_DIR) $(BIN_DIR)/
	-$(DEL_DIR) $(DOC_DIR)/

clean: clean-doc
	-$(DEL_FILE) $(TARGET) *.o core

clean-doc: make-defs
	-$(MAKE) -C doc/ -f Makefile.posix clean

clean-changelog:
	-$(DEL_FILE) ChangeLog*

clean-defs:
	-$(DEL_FILE) $(DOC_DEFS)

clean-in:
	-for FILE in *.in; \
	do \
		rm -f $${FILE:0:$${#FILE}-3}; \
	done

dist: distbin distsrc

dist-fc5: dist rpmbuild
	for FILE in $(PRODUCT)-$(VERSION)-[0-9].i686.rpm; \
	do \
		$(RENAME_FILE) $$FILE $$(echo $$FILE | sed s/.i686./.fc5.i686./); \
	done
	for FILE in $(PRODUCT)-$(VERSION)-[0-9].src.rpm; \
	do \
		$(RENAME_FILE) $$FILE $$(echo $$FILE | sed s/.src./.fc5.src./); \
	done

dist-rh7: dist rpm
	for FILE in $(PRODUCT)-$(VERSION)-[0-9].i386.rpm; \
	do \
		$(RENAME_FILE) $$FILE $$(echo $$FILE | sed s/.i386./.rh7.i386./); \
	done
	for FILE in $(PRODUCT)-$(VERSION)-[0-9].src.rpm; \
	do \
		$(RENAME_FILE) $$FILE $$(echo $$FILE | sed s/.src./.rh7.src./); \
	done

distbin: install-strip distbin-gz distbin-bz2 distbin-zip distbin-rar distbin-7z

distbin-gz:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-$(SYST).tar.gz
	cd $(PREFIX) && \
		$(TARGZ) ../$(PRODUCT)-$(VERSION)-$(SYST).tar.gz *

distbin-bz2:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-$(SYST).tar.bz2
	cd $(PREFIX) && \
		$(TARBZ2) ../$(PRODUCT)-$(VERSION)-$(SYST).tar.bz2 *

distbin-zip:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-$(SYST).zip
	cd $(PREFIX) && \
		$(ZIP) ../$(PRODUCT)-$(VERSION)-$(SYST).zip *

distbin-rar:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-$(SYST).rar
	cd $(PREFIX) && \
		$(RAR) ../$(PRODUCT)-$(VERSION)-$(SYST).rar *

distbin-7z:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-$(SYST).7z
	cd $(PREFIX) && \
		$(7ZIP) ../$(PRODUCT)-$(VERSION)-$(SYST).7z *

rpmbuild: distsrc make-spec
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-*.i686.rpm
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-*.src.rpm
	$(COPY_FILE) $(PRODUCT)-$(VERSION).tar.gz $(HOME)/rpmbuild/SOURCES
	$(RPMBUILD) --target=i686 $(PRODUCT).spec
	$(COPY_FILE) $(HOME)/rpmbuild/RPMS/i686/$(PRODUCT)-$(VERSION)-*.i686.rpm .
	$(COPY_FILE) $(HOME)/rpmbuild/SRPMS/$(PRODUCT)-$(VERSION)-*.src.rpm .

rpm: distsrc make-spec
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-*.i386.rpm
	-$(DEL_FILE) $(PRODUCT)-$(VERSION)-*.src.rpm
	$(COPY_FILE) $(PRODUCT)-$(VERSION).tar.gz $(HOME)/rpm/SOURCES
	$(RPM) --target=i386 $(PRODUCT).spec
	$(COPY_FILE) $(HOME)/rpm/RPMS/i386/$(PRODUCT)-$(VERSION)-*.i386.rpm .
	$(COPY_FILE) $(HOME)/rpm/SRPMS/$(PRODUCT)-$(VERSION)-*.src.rpm .

distsrc: distsrc-prep distsrc-gz distsrc-bz2 distsrc-zip distsrc-rar distsrc-7z

distsrc-prep: make-changelog doc
	$(CHECK_EXIST_DIR) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION) && \
		$(DEL_DIR) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/* || \
		$(CREATE_DIR) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)
	$(CREATE_DIR) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/doc
	$(CREATE_DIR) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/devtools
	$(COPY_FILE) ChangeLog $(MKFILES) $(SOURCES) $(RESOURCES) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/
	$(COPY_FILE) $(DOC_SOURCES) $(DOC_MKFILES) $(DOC_RESOURCES) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/doc/
	$(COPY_FILE) $(TOOLS) $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/devtools/
	$(COPY_FILE) doc/$(TXT_DIR)/DISCLAIMER.txt $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/DISCLAIMER
	$(COPY_FILE) doc/$(TXT_DIR)/INSTALL.txt $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/INSTALL
	$(COPY_FILE) doc/$(TXT_DIR)/LICENSE.txt $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/LICENSE
	$(COPY_FILE) doc/$(TXT_DIR)/README.txt $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/README
	$(COPY_FILE) doc/$(TXT_DIR)/TODO.txt $(SRC_PREFIX)/$(PRODUCT)-$(VERSION)/TODO

distsrc-gz:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION).tar.gz
	cd $(SRC_PREFIX) && \
		$(TARGZ) ../$(PRODUCT)-$(VERSION).tar.gz $(PRODUCT)-$(VERSION)/

distsrc-bz2:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION).tar.bz2
	cd $(SRC_PREFIX) && \
		$(TARBZ2) ../$(PRODUCT)-$(VERSION).tar.bz2 $(PRODUCT)-$(VERSION)/

distsrc-zip:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION).zip
	cd $(SRC_PREFIX) && \
		$(ZIP) ../$(PRODUCT)-$(VERSION).zip $(PRODUCT)-$(VERSION)/

distsrc-rar:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION).rar
	cd $(SRC_PREFIX) && \
		$(RAR) ../$(PRODUCT)-$(VERSION).rar $(PRODUCT)-$(VERSION)/

distsrc-7z:
	-$(DEL_FILE) $(PRODUCT)-$(VERSION).7z
	cd $(SRC_PREFIX) && \
		$(7ZIP) ../$(PRODUCT)-$(VERSION).7z $(PRODUCT)-$(VERSION)/

distcvs: distsrc-prep distsrc-gz distsrc-bz2 distsrc-zip distsrc-rar distsrc-7z
	$(RENAME_FILE) $(PRODUCT)-$(VERSION).tar.gz $(PRODUCT)-cvs-snapshot.tar.gz
	$(RENAME_FILE) $(PRODUCT)-$(VERSION).tar.bz2 $(PRODUCT)-cvs-snapshot.tar.bz2
	$(RENAME_FILE) $(PRODUCT)-$(VERSION).zip $(PRODUCT)-cvs-snapshot.zip
	$(RENAME_FILE) $(PRODUCT)-$(VERSION).rar $(PRODUCT)-cvs-snapshot.rar
	$(RENAME_FILE) $(PRODUCT)-$(VERSION).7z $(PRODUCT)-cvs-snapshot.7z

distclean: uninstall clean distclean-doc clean-changelog clean-defs clean-in
	-$(DEL_DIR) dist-linux/
	-$(DEL_DIR) dist-src/

distclean-doc: make-defs
	-$(MAKE) -C doc/ -f Makefile.posix distclean

make-changelog:
	$(CHECK_EXIST_FILE) ChangeLog || \
		$(PERL) $(CVS2CL)

make-defs:
	echo "INSTALL_HTML_DIR = $(DOC_DIR)/html" > $(DOC_DEFS)
	echo "INSTALL_TXT_DIR = $(DOC_DIR)/txt" >> $(DOC_DEFS)
	echo "INSTALL_MAN_DIR = $(DOC_DIR)/man" >> $(DOC_DEFS)
	echo "INSTALL_PDF_DIR = $(DOC_DIR)/pdf" >> $(DOC_DEFS)

make-spec:
	-$(DEL_FILE) $(PRODUCT).spec
	sed -e "s/@PRODUCT@/$(PRODUCT)/g" -e "s/@VERSION@/$(VERSION)/g" -e "s/@DESCRIPTION@/$(DESCRIPTION)/g" \
		-e "s/@AUTHOR_CONTACT@/$(AUTHOR_CONTACT)/g" -e "s/@HOMEPAGE@/$(HOMEPAGE)/g" -e "s/@CATEGORY@/$(CATEGORY)/g" \
		-e "s/@LICENSE@/$(LICENSE)/g" $(PRODUCT).spec.in > $(PRODUCT).spec