File: Makefile.unix

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 (170 lines) | stat: -rw-r--r-- 4,654 bytes parent folder | download | duplicates (6)
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
include Makefile.unix.inc
include doc/Makefile.inc

CC		?= gcc
CFLAGS	?= -O2 -ansi -pedantic -Wall -W
#CFLAGS	?= -g -ansi -pedantic -Wall -W
CFLAGS  += -DOS_UNIX -DPRODUCT_ID="\"$(PRODUCT)\"" -DPRODUCT_VERSION="\"$(VERSION)\""
ifeq ($(SYSTBASE),freebsd)
CFLAGS  += -DOS_FREEBSD
else
ifeq ($(SYSTBASE),sunos)
CFLAGS  += -D_REENTRANT -DOS_SUNOS
else
ifeq ($(SYSTBASE),hpux)
CFLAGS	+= -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE -DOS_HPUX
else
ifeq ($(SYSTBASE),aix)
CFLAGS	+= -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -DOS_AIX
endif
endif
endif
endif
PREFIX	?= $(shell pwd)/dist-unix

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

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


default: all

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

all: $(TARGET)

full: clean all

deps: $(OBJECTS)

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

$(TARGET): deps
	$(CC) $(LFLAGS) -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

distbin: install-strip distbin-gz distbin-bz2

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

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

distsrc: distsrc-prep distsrc-gz distsrc-bz2

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) && \
		$(TAR) ../$(PRODUCT)-$(VERSION).tar $(PRODUCT)-$(VERSION)/ && \
			$(GZIP) ../$(PRODUCT)-$(VERSION).tar

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

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

distclean: uninstall clean distclean-doc clean-changelog clean-defs clean-in
	-$(DEL_DIR) dist-unix/
	-$(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)