comparison mk/prog.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 # prog.mk - compile a program, in portable make.
3 #
4 # Before including, set:
5 # PROG program to build
6 # SRCS sources
7 # RCFILES (optional) Windows resource files
8 # SYNS (optional) AG syntax files
9 # SYNOUTPUTEXT (optional) output suffix for AG files
10 # AGFILEDEST (optional) destination for AG files ("here" or "srcdir")
11 #
12
13 SYNOUTPUTEXT?=.cpp
14 AGFILEDEST?=srcdir
15
16 include $(BUILDTOP)/config.mk
17
18 # beforeall used by: agfile-rules.sh when AGFILEDEST==here
19 # afterall used by: none
20
21 all: beforeall doall afterall
22 beforeall doall afterall:;
23
24 # BSD make has .WAIT to make beforeall/afterall work, but gmake doesn't.
25 .NOTPARALLEL:
26
27 doall: $(PROG)$(EXEEXT)
28 TYPE=PROG
29
30 include rules.mk
31 include depend.mk
32
33 $(PROG)$(EXEEXT): $(OBJS) $(RESFILES) $(MYLIBS)
34 @echo ' [DEP]'
35 @$(MKDEP)
36 @echo ' [LINK] $@'
37 @$(LDCC) $(LDFLAGS) $(OBJS) $(RESFILES) $(MYLIBS) $(LIBS) -o $@
38
39 rules:
40 @$(TOP)/mk/include-defs.sh '$(INCDIRS)' > rules.mk
41 @$(TOP)/mk/compile-rules.sh '$(SRCS)' '$(RCFILES)' >> rules.mk
42 @$(TOP)/mk/agfile-rules.sh $(AGFILEDEST) '$(SYNS)' '$(SYNOUTPUTEXT)' \
43 >> rules.mk
44 # @echo ' [RULES]'
45
46 depend:
47 @echo ' [DEP]'
48 @$(MKDEP)
49
50 clean:
51 @echo ' [RM] $(PROG)$(EXEEXT) $(CLEANFILES) *~'
52 @rm -f $(PROG)$(EXEEXT) $(CLEANFILES) *~
53
54 distclean: clean
55 @echo ' [RM] $(DISTCLEANFILES) *~'
56 @rm -f $(DISTCLEANFILES) *~
57
58 .PHONY: all rules depend clean distclean