comparison mk/lib.mk @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children bb115deb6fb2
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 #
2 # lib.mk - build a library, in portable make.
3 #
4 # Before including, set:
5 # LIB library to build
6 # LIBTYPE LIB or SHLIB (or $(AGLIBTYPE))
7 #
8 # and set:
9 # SRCS sources
10 # RCFILES (optional) Windows resource files
11 # SYNS (optional) AG syntax files
12 # SYNOUTPUTEXT (optional) output suffix for AG files
13 # AGFILEDEST (optional) destination for AG files ("here" or "srcdir")
14 #
15
16 SYNOUTPUTEXT?=.cpp
17 AGFILEDEST?=srcdir
18
19 include $(BUILDTOP)/config.mk
20
21 # beforeall used by: cg46.h in anagram
22 # afterall used by: none
23
24 all: beforeall doall afterall
25 beforeall doall afterall:;
26
27 # BSD make has .WAIT to make beforeall/afterall work, but gmake doesn't.
28 .NOTPARALLEL:
29
30 doall: all.$(LIBTYPE)
31 all.LIB: $(LIB)$(LIBEXT)
32 all.SHLIB: $(LIB)$(SHLIBEXT)
33 TYPE=$(LIBTYPE)
34
35 include rules.mk
36 include depend.mk
37
38 $(LIB)$(LIBEXT): $(OBJS) $(MYLIBS)
39 @echo ' [DEP]'
40 @$(MKDEP)
41 @echo ' [LIB] $@'
42 @$(LDR) $(LIB)$(LIBEXT) $(OBJS) $(RESFILES) $(MYLIBS)
43
44 $(LIB)$(SHLIBEXT): $(OBJS) $(MYLIBS)
45 @echo ' [DEP]'
46 @$(MKDEP)
47 @echo ' [SHLIB] $@'
48 @$(SHLDCC) $(OBJS) $(RESFILES) $(MYLIBS) -o $@
49
50 rules:
51 @$(TOP)/mk/include-defs.sh '$(INCDIRS)' > rules.mk
52 @$(TOP)/mk/compile-rules.sh '$(SRCS)' '$(RCFILES)' >> rules.mk
53 @$(TOP)/mk/agfile-rules.sh $(AGFILEDEST) '$(SYNS)' '$(SYNOUTPUTEXT)' \
54 >> rules.mk
55 # @echo ' [RULES]'
56
57 depend:
58 @echo ' [DEP]'
59 @$(MKDEP)
60
61 clean:
62 @echo ' [RM] $(CLEANFILES) *~'
63 @rm -f $(CLEANFILES) *~
64
65 distclean: clean
66 @echo ' [RM] $(DISTCLEANFILES) *~'
67 @rm -f $(DISTCLEANFILES) *~
68
69 .PHONY: all rules depend clean distclean
70 .PHONY: beforeall doall afterall
71 .PHONY: beforedepend dodepend afterdepend
72 .PHONY: all.LIB all.SHLIB