aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b468479339ea75dd994976f806d6e6f3ef0019fa (plain)
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
prefix          = /usr/local
exec_prefix     = ${prefix}
srcdir          = .
BINDIR		= ${exec_prefix}/bin
LIBDIR		= ${exec_prefix}/lib
MANDIR		= ${prefix}/man
INCLUDEDIR	= ${prefix}/include



RM              = rm -f
LN_S            = ln -s
RANLIB          = ranlib
INSTALL         = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA    = ${INSTALL} -m 644
SHELL           = /bin/sh

NAME		= compface
UNNAME		= uncompface
EXEEXT		= 
NAMEEXE		= $(NAME)$(EXEEXT)
UNNAMEEXE	= $(UNNAME)$(EXEEXT)
EXECUTABLE	= $(BINDIR)/$(NAMEEXE)
UNEXECUTABLE	= $(BINDIR)/$(UNNAMEEXE)
LIBNAME		= lib$(NAME).a
SOLIBNAME	= lib$(NAME).so
LIBRARY		= $(LIBDIR)/$(LIBNAME)
MAN1DIR		= $(MANDIR)/man1
MAN3DIR		= $(MANDIR)/man3
OBJECTS		= arith.o file.o compress.o gen.o uncompface.o compface.o
SOURCES		= compface.c uncompface.c arith.c file.c compress.c gen.c \
		  cmain.c uncmain.c version.c
INSTALLHEADERS  = compface.h
HDRS		= $(INSTALLHEADERS) data.h compface_private.h
OTHERS		= README $(NAME).1 $(NAME).3 Makefile.in Makefile.Ashton \
		  configure configure.in install-sh mkinstalldirs ChangeLog

DISTFILES       =  $(OTHERS) $(HDRS) $(SOURCES)

CC		= gcc
CFLAGS		= -g -O2
#CFLAGS		= -g 
DEFS		= -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRERROR=1  -DHAVE_CONFIG_H
LDFLAGS		= 
LIBS		= 

all:		$(NAMEEXE) $(UNNAMEEXE)

$(NAMEEXE) :	cmain.o $(LIBNAME)
		$(CC) $(LDFLAGS) -o $@ cmain.o -lcompface

$(UNNAMEEXE) :	uncmain.o $(LIBNAME)
		$(CC) $(LDFLAGS) -o $@ uncmain.o -lcompface

$(LIBNAME) :	$(OBJECTS)
		ar rc $(LIBNAME) $(OBJECTS)
		-$(RANLIB) $(LIBNAME)

lint :
		lint -abchx $(SOURCES)

clean :
		-rm -f *.o *.a *.sh core a.out $(NAMEEXE) $(UNNAMEEXE)

distclean: clean
		-rm -rf *~
		-rm -f config.log config.status config.cache Makefile

dist: $(DISTFILES)
		echo compface-`sed -e '/version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
		$(RM) -rf `cat .fname`
		mkdir `cat .fname`
		ln $(DISTFILES) `cat .fname`
		tar chzf `cat .fname`.tar.gz `cat .fname`
		$(RM) -rf `cat .fname` .fname

install: 	$(NAMEEXE) $(UNNAMEEXE) $(LIBNAME)
		$(INSTALL_PROGRAM) -d $(BINDIR) $(LIBDIR) $(MAN1DIR) $(MAN3DIR) $(INCLUDEDIR)
		$(INSTALL_PROGRAM) $(srcdir)/$(NAMEEXE) $(EXECUTABLE) 
		-chmod 0755 $(EXECUTABLE)
		-strip $(EXECUTABLE)
		$(INSTALL_PROGRAM) $(srcdir)/$(UNNAMEEXE) $(UNEXECUTABLE)
		-chmod 0755 $(UNEXECUTABLE)
		-strip $(UNEXECUTABLE)
		$(INSTALL_DATA) $(srcdir)/$(NAME).1 $(MAN1DIR)/$(NAME).1
		cd $(MAN1DIR) && $(RM) ./$(UNNAME).1 && $(LN_S) $(NAME).1 $(UNNAME).1
		$(INSTALL_DATA) $(srcdir)/$(NAME).3 $(MAN3DIR)/$(NAME).3
		cd $(MAN3DIR) && $(RM) ./$(UNNAME).3 && $(LN_S) $(NAME).3 $(UNNAME).3
		for hdr in $(INSTALLHEADERS); do $(INSTALL_DATA) $(srcdir)/$${hdr} $(INCLUDEDIR)/$${hdr}; done
		$(INSTALL_DATA) $(srcdir)/$(LIBNAME) $(LIBRARY)

shar :
		shar.script $(OTHERS) $(HDRS) $(SOURCES) > $(NAME).sh
		compress $(NAME).sh

static:		$(OBJECTS)
		ar rc $(LIBNAME) $(OBJECTS)
		-ranlib $(LIBNAME)

shared:		$(OBJECTS)
		$(CC) -shared -Wl,-soname,$(SOLIBNAME).1 $(LDFLAGS) -o $(SOLIBNAME).1.0.0 $(OBJECTS)

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

arith.o:	arith.c compface.h data.h
cmain.o:	cmain.c compface.h data.h
compface.o:	compface.c compface.h data.h
compress.o:	compress.c compface.h data.h
file.o:		file.c compface.h data.h
gen.o:		gen.c compface.h data.h
uncmain.o:	uncmain.c compface.h data.h
uncompface.o:	uncompface.c compface.h data.h

.PHONY: clean mostlyclean distclean realclean dist all shared static

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT: