Mercurial > hg > index.cgi
annotate Makefile @ 188:b6685a7ec2bd
Add stub for lwcc
author | lost@l-w.ca |
---|---|
date | Wed, 11 Jan 2012 20:18:10 -0700 |
parents | 5350ce9f446f |
children | 8a84141ea6dd |
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 | 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 | 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 |
188 | 36 lwcc_srcs := lwcc.c |
37 | |
38 lwcc_srcs := $(addprefix lwcc/,$(lwcc_srcs)) | |
39 | |
40 | |
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 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
|
42 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
|
43 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
|
44 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
|
45 lwobjdump_objs := $(lwobjdump_srcs:.c=.o) |
188 | 46 lwcc_objs := $(lwcc_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
|
47 |
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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 lwobjdump_deps := $(lwobjdump_srcs:.c=.d) |
188 | 53 lwcc_deps := $(lwcc_srcs:.c=.d) |
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
|
54 |
188 | 55 .PHONY: lwlink lwasm lwar lwobjdump lwcc |
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
|
56 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
|
57 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
|
58 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
|
59 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) |
188 | 60 lwcc: lwcc/lwcc$(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
|
61 |
22 | 62 .PHONY: lwbasic |
63 lwbasic: lwbasic/lwbasic$(PROGSUFFIX) | |
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 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib lwasm/rules.make |
11 | 66 @echo Linking $@ |
67 @$(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
|
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 lwlink/lwlink$(PROGSUFFIX): $(lwlink_objs) lwlib lwlink/rules.make |
11 | 70 @echo Linking $@ |
71 @$(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
|
72 |
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
|
73 lwlink/lwobjdump$(PROGSUFFIX): $(lwobjdump_objs) lwlib lwlink/rules.make |
11 | 74 @echo Linking $@ |
75 @$(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
|
76 |
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
|
77 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
|
78 @echo Linking $@ |
11 | 79 @$(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
|
80 |
188 | 81 lwcc/lwcc$(PROGSUFFIX): $(lwcc_objs) lwlib |
82 @echo Linking $@ | |
83 @$(CC) -o $@ $(lwcc_objs) $(LDFLAGS) | |
84 | |
17
4969bd6f3b7d
Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents:
16
diff
changeset
|
85 #.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
|
86 .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
|
87 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
|
88 |
3 | 89 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make |
11 | 90 @echo Linking $@ |
91 @$(AR) rc $@ $(lwlib_objs) | |
92 @$(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
|
93 |
188 | 94 alldeps := $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) ($lwobjdump_deps) $(lwcc_deps) |
3 | 95 |
96 -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
|
97 |
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
|
98 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
|
99 |
11 | 100 %.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
|
101 @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
|
102 @$(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
|
103 @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
|
104 @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
|
105 @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
|
106 @rm -f $*.d.tmp |
11 | 107 @echo Building $@ |
108 @$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< | |
109 | |
110 | |
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
|
111 .PHONY: clean |
22 | 112 clean: $(cleantargs) |
11 | 113 @echo "Cleaning up" |
188 | 114 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) lwcc/lwcc$(PROGSUFFIX) |
115 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) $(lwcc_objs) | |
11 | 116 @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
|
117 @rm -f */*.exe |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
1
diff
changeset
|
118 |
16
2f98cf1558e1
Added building of manual from docbook source to Makefile
lost@l-w.ca
parents:
11
diff
changeset
|
119 .PHONY: realclean |
22 | 120 realclean: clean $(realcleantargs) |
16
2f98cf1558e1
Added building of manual from docbook source to Makefile
lost@l-w.ca
parents:
11
diff
changeset
|
121 @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
|
122 @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
|
123 @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
|
124 |
2
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
1
diff
changeset
|
125 print-%: |
7317fbe024af
Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents:
1
diff
changeset
|
126 @echo $* = $($*) |
3 | 127 |
128 .PHONY: install | |
129 install: | |
130 cp $(MAIN_TARGETS) /usr/local/bin/ | |
173 | 131 |
132 .PHONY: test | |
133 test: all test/runtests | |
134 @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
|
135 |