annotate Makefile @ 183:c6a38fd8bd33

Added --entry option for lwlink
author lost@l-w.ca
date Thu, 22 Dec 2011 18:01:59 -0700
parents 5350ce9f446f
children b6685a7ec2bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
1 # define anything system specific here
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
2 #
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
3 # set these variables if needed
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
4 # PROGSUFFIX: suffix added to binaries
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
5 # BUILDTPREFIX: prefix added to build utilities (cc, etc.) for xcompile
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
6 # can also set them when invoking "make"
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
7 #PROGSUFFIX := .exe
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
8 #BUILDTPREFIX=i586-mingw32msvc-
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
9
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
10 # C compiler
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
11 CC := $(BUILDTPREFIX)cc
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
12
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
13 # ar
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
14 AR := $(BUILDTPREFIX)ar
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
15
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
16 # ranlib
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
17 RANLIB := $(BUILDTPREFIX)ranlib
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
18
126
2eda3e39b3b8 Marked development beyond 4.4 in version
William Astle <lost@l-w.ca>
parents: 123
diff changeset
19 CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.4+"'
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
20 LDFLAGS += -L$(PWD)/lwlib -llw
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
21
25
87590f43e76d Started lwbasic parser; checkpoint
lost@l-w.ca
parents: 22
diff changeset
22 CFLAGS ?= -g -Wall
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
23
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
24 MAIN_TARGETS := lwasm/lwasm$(PROGSUFFIX) \
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
25 lwlink/lwlink$(PROGSUFFIX) \
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
26 lwar/lwar$(PROGSUFFIX) \
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
27 lwlink/lwobjdump$(PROGSUFFIX)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
28
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
29 .PHONY: all
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
30 all: $(MAIN_TARGETS)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
31
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
32 subdirs := lwasm lwlink lwar lwlib lwbasic docs
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
33
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
34 -include $(subdirs:=/rules.make)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
35
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
36 lwasm_objs := $(lwasm_srcs:.c=.o)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
37 lwlink_objs := $(lwlink_srcs:.c=.o)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
38 lwar_objs := $(lwar_srcs:.c=.o)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
39 lwlib_objs := $(lwlib_srcs:.c=.o)
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
40 lwobjdump_objs := $(lwobjdump_srcs:.c=.o)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
41
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
42 lwasm_deps := $(lwasm_srcs:.c=.d)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
43 lwlink_deps := $(lwlink_srcs:.c=.d)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
44 lwar_deps := $(lwar_srcs:.c=.d)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
45 lwlib_deps := $(lwlib_srcs:.c=.d)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
46 lwobjdump_deps := $(lwobjdump_srcs:.c=.d)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
47
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
48 .PHONY: lwlink lwasm lwar lwobjdump
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
49 lwlink: lwlink/lwlink$(PROGSUFFIX)
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
50 lwasm: lwasm/lwasm$(PROGSUFFIX)
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
51 lwar: lwar/lwar$(PROGSUFFIX)
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
52 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
53
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
54 .PHONY: lwbasic
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
55 lwbasic: lwbasic/lwbasic$(PROGSUFFIX)
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
56
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
57 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib lwasm/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
58 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
59 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
60
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
61 lwlink/lwlink$(PROGSUFFIX): $(lwlink_objs) lwlib lwlink/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
62 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
63 @$(CC) -o $@ $(lwlink_objs) $(LDFLAGS)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
64
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
65 lwlink/lwobjdump$(PROGSUFFIX): $(lwobjdump_objs) lwlib lwlink/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
66 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
67 @$(CC) -o $@ $(lwobjdump_objs) $(LDFLAGS)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
68
10
127e5b1e01c0 Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
lost@l-w.ca
parents: 9
diff changeset
69 lwar/lwar$(PROGSUFFIX): $(lwar_objs) lwlib lwar/rules.make
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
70 @echo Linking $@
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
71 @$(CC) -o $@ $(lwar_objs) $(LDFLAGS)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
72
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
73 #.PHONY: lwlib
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
74 .INTERMEDIATE: lwlib
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
75 lwlib: lwlib/liblw.a
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
76
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
77 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
78 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
79 @$(AR) rc $@ $(lwlib_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
80 @$(RANLIB) $@
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
81
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
82 alldeps := $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) ($lwobjdump_deps)
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
83
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
84 -include $(alldeps)
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
85
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
86 extra_clean := $(extra_clean) *~ */*~
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
87
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
88 %.o: %.c
181
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
89 @echo "Building dependencies for $@"
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
90 @$(CC) -MM $(CPPFLAGS) -o $*.d $<
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
91 @mv -f $*.d $*.d.tmp
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
92 @sed -e 's|.*:|$*.o $*.d:|' < $*.d.tmp > $*.d
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
93 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
5350ce9f446f Arranged for dependencies to be generated when building object files; no more extraneous dependency rebuilds
lost@l-w.ca
parents: 173
diff changeset
94 @rm -f $*.d.tmp
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
95 @echo Building $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
96 @$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
97
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
98
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
99 .PHONY: clean
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
100 clean: $(cleantargs)
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
101 @echo "Cleaning up"
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
102 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
103 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
104 @rm -f $(extra_clean)
20
f4df3bd4b85f Moved removal of dep files to realclean and properly remove any .exe files
lost@l-w.ca
parents: 17
diff changeset
105 @rm -f */*.exe
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
106
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
107 .PHONY: realclean
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
108 realclean: clean $(realcleantargs)
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
109 @echo "Cleaning up even more"
20
f4df3bd4b85f Moved removal of dep files to realclean and properly remove any .exe files
lost@l-w.ca
parents: 17
diff changeset
110 @rm -f $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) $(lwobjdump_deps)
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
111 @rm -f docs/manual/*.html docs/manual/*.pdf
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
112
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
113 print-%:
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
114 @echo $* = $($*)
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
115
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
116 .PHONY: install
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
117 install:
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
118 cp $(MAIN_TARGETS) /usr/local/bin/
173
3413a88f4d09 Added test framework
lost@l-w.ca
parents: 126
diff changeset
119
3413a88f4d09 Added test framework
lost@l-w.ca
parents: 126
diff changeset
120 .PHONY: test
3413a88f4d09 Added test framework
lost@l-w.ca
parents: 126
diff changeset
121 test: all test/runtests
3413a88f4d09 Added test framework
lost@l-w.ca
parents: 126
diff changeset
122 @test/runtests
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
123