mkmi.m4 3.6 KB
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
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
dnl $Id: mkmi.m4,v 1.1 1994/03/03 00:44:54 ceder Exp $
dnl Create Makefile.in from Makefile.src
dnl
changequote([,])dnl
dnl
dnl LK_descend(cmd, deps, localcmd) expands to
dnl
dnl	.PHONY: cmd
dnl	cmd: deps
dnl	localcmd
dnl		[code to perform cmd in $SUBDIRS]
dnl
dnl localcmd should typically be empty or contain commands to perform
dnl cmd in the current directory.  All lines in localcmd should begin
dnl with a tab.
dnl
define([LK_descend], [[.PHONY: ]$1
$1: $2
$3	[for i in DuMmY $(SUBDIRS); do \
		if test -f $$i/Makefile ; then \
			echo making] $1 [in directory $$i; \
			if (cd ./$$i; $(MAKE) ] $1 [ ); 
			then true; else exit 1; fi ; \
		else true; fi; \
	done
]])dnl
dnl
define([LK_cmd],[[	]$1[
]])dnl
define([domostlyclean],[LK_cmd([$(RM) $(GENERIC-MOSTLYCLEAN)])])dnl
define([doclean],)dnl
define([dodistclean],[LK_cmd([$(RM) $(GENERIC-DISTCLEAN)])])dnl
define([dorealclean],)dnl
define([dopure],)dnl
define([LK_CLEAN],[dnl
[# Output from LK_CLEAN
GENERIC-MOSTLYCLEAN = *.o lib*.a core temp-Makefile temp-?-Makefile
GENERIC-DISTCLEAN = *~ .\#* TAGS dependencies Makefile]
LK_descend([[mostlyclean]],[[domostlyclean]])
LK_descend([[clean]],[[doclean]])
LK_descend([[distclean]],[[dodistclean]])
LK_descend([[realclean]],[[dorealclean]])
LK_descend([[pure]],[[dopure]])
[dopure: dorealclean]
dopure
[dorealclean: dodistclean]
dorealclean
[dodistclean: doclean]
dodistclean
[doclean: domostlyclean]
doclean
[domostlyclean:]
domostlyclean
[# End output from LK_CLEAN]]
)dnl End of LK_CLEAN
dnl
define([dodepend],)dnl
define([predepend],)dnl
dnl
define([LK_ALL_C_DEPEND],[define([dodepend],dnl
[LK_cmd([$(CC) $(DEPENDFLAG) $(CFLAGS) $(srcdir)/*.c $(C_SPECIALS) \
		>dependencies])])dnl
define([predepend],[[$(C_SPECIALS)]])])dnl
dnl
define([LK_DEPEND],[[dependencies:
	touch dependencies]

LK_descend([[depend]],[predepend],[dodepend])])dnl end LK_DEPEND
dnl
define([LK_INSTALL_HDRS],
[[INSTALL-HDRS = ]$1
[HDRS-DIR =$(INCLUDEDIR)]$2
define([doincludes],
[[	test -d $(HDRS-DIR) || $(MKDIR) $(HDRS-DIR)
	for i in $(INSTALL-HDRS) ; \
	do if ( cmp $(srcdir)/$$i $(HDRS-DIR)/$$i 2>/dev/null ) ; then\
		$(RM) $(HDRS-DIR)/$$i;\
		if $(INSTALL_DATA) $(srcdir)/$$i $(HDRS-DIR)/$$i; \
		then true ; else exit 1; fi \
	   else true; fi\
	done;]])dnl end of doincludes
])dnl end of LK_INSTALL_HDRS
dnl
define([LK_STD_LIB],
[[LIBNAME = ]$1
[LIBOBJS = ]$2

[$(LIBNAME): $(LIBOBJS)
	$(AR) $(ARFLAGS) $@ $?
	$(RANLIB) $@]
define([dolibraries],
[[	$(RM) $(LIBDIR)/$(LIBNAME)
	cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
	$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)]])dnl end of dolibraries
define([prelibraries],[[$(LIBNAME)]])dnl end of prelibraries
])dnl end of LK_STD_LIB


define([LK_DESCEND],dnl
[LK_descend([[includes]],,[doincludes])
LK_descend([[libraries]],[prelibraries],[dolibraries])
LK_descend([[binaries]])
LK_descend([[install]])
LK_DEPEND
LK_CLEAN])dnl end of LK_DESCEND
dnl
dnl
define([LK_STD],[[# Begin LK_STD
SHELL = /bin/sh

AWK = @AWK@
CC = @CC@
CFLAGS = @CFLAGS@
ALL_CFLAGS = @INCLUDE_CURRENT@ -I@srcdir@ -I@BUILDTOPDIR@/include \
	-I@BUILDTOPDIR@/include/server $(DEFS) $(CFLAGS)

DEPENDFLAG = @DEPENDFLAG@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LEX = @LEX@
MKDIR = mkdir
RANLIB = @RANLIB@
RM = rm -f
SED = @SED@
SYMLINK = @LN_S@
TOUCHLIB = @RANLIB@
YACC = @YACC@

INCLUDEDIR = @BUILDTOPDIR@/include
LIBDIR = @BUILDTOPDIR@/lib
prefix = /usr/lyskom
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
dbdir = $(exec_prefix)/db
etcdir = $(exec_prefix)/etc
coredir = $(exec_prefix)/cores

DEFS = @DEFS@
LDFLAGS = @LDFLAGS@
SCRIPTDIR = @SRCTOPDIR@/scripts

.c.o:
	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
# END section from @STDLYSKOM@
]])dnl LK_STD