summaryrefslogtreecommitdiffstats
path: root/replace/Makefile.in
blob: 0986d601a92ed0317928f899602ec35ffca9925b (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
#!gmake
#
CC = @CC@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
VPATH = @libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
sharedbuilddir = @sharedbuilddir@
INSTALLCMD = @INSTALL@
LIBS = @LIBS@

.PHONY: test all showflags install installcheck clean distclean realdistclean

CFLAGS += -I. @CFLAGS@
LDFLAGS += @LDFLAGS@

OBJS = @LIBREPLACEOBJ@

all: showflags libreplace.a testsuite

showflags:
	@echo 'libreplace will be compiled with flags:'
	@echo '  CC     = $(CC)'
	@echo '  CFLAGS = $(CFLAGS)'
	@echo '  LDFLAGS= $(LDFLAGS)'
	@echo '  LIBS   = $(LIBS)'

install: all
	${INSTALLCMD} -d $(libdir)
	${INSTALLCMD} -m 644 libreplace.a $(libdir)

shared-build: all
	${INSTALLCMD} -d $(sharedbuilddir)/include
	${INSTALLCMD} -m 644 replace.h $(sharedbuilddir)/include
	${INSTALLCMD} -d $(sharedbuilddir)/lib
	${INSTALLCMD} -m 644 libreplace.a $(sharedbuilddir)/lib

libreplace.a: $(OBJS)
	ar -rcsv $@ $(OBJS)

test: all
	./testsuite

installcheck: install test

TEST_OBJS = test/main.o test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o

testsuite: libreplace.a $(TEST_OBJS)
	$(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)

.c.o:
	@echo Compiling $*.c
	@mkdir -p `dirname $@`
	@$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f *.o test/*.o *.a testsuite
	rm -f testfile.dat

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

realdistclean: distclean
	rm -f configure config.h.in