annotate Makefile @ 20:f4df3bd4b85f

Moved removal of dep files to realclean and properly remove any .exe files
author lost@l-w.ca
date Sat, 22 Jan 2011 18:06:37 -0700
parents 4969bd6f3b7d
children 7c35fa8dbc91
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
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
19 CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.0-pre"'
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
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
22
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 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
24 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
25 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
26 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
27
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 .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
29 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
30
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
31 subdirs := lwasm lwlink lwar lwlib 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
32
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 -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
34
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 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
36 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
37 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
38 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
39 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
40
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_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
42 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
43 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
44 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
45 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
46
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
47 .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
48 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
49 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
50 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
51 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
52
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
53 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib lwasm/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
54 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
55 @$(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
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 lwlink/lwlink$(PROGSUFFIX): $(lwlink_objs) lwlib lwlink/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 $@ $(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
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/lwobjdump$(PROGSUFFIX): $(lwobjdump_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 $@ $(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
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 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
66 @echo Linking $@
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
67 @$(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
68
8
fdc11ef4115b Switched lwlink to lw_cmdline from argp and also brought in lw_alloc and lw_string to replace util.c
lost@l-w.ca
parents: 3
diff changeset
69 test: test.c lwlib
fdc11ef4115b Switched lwlink to lw_cmdline from argp and also brought in lw_alloc and lw_string to replace util.c
lost@l-w.ca
parents: 3
diff changeset
70 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ test.c $(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
71
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
72 #.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
73 .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
74 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
75
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
76 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
77 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
78 @$(AR) rc $@ $(lwlib_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
79 @$(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
80
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 %.d: %.c
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
82 @echo "Building dependencies for $@"
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
83 @$(CC) -MM $(CPPFLAGS) -o $*.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
84 @mv -f $*.d $*.d.tmp
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 @sed -e 's|.*:|$*.o $*.d:|' < $*.d.tmp > $*.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
86 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.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
87 @rm -f $*.d.tmp
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
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
89 alldeps := $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) ($lwobjdump_deps)
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
90
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
91 -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
92
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 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
94
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
95 %.o: %.c
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
96 @echo Building $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
97 @$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
98
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
99
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
100 .PHONY: 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
101 clean:
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
102 @echo "Cleaning up"
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
103 @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
104 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
105 @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
106 @rm -f */*.exe
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
107
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
108 .PHONY: realclean
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
109 realclean: clean
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
110 @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
111 @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
112 @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
113
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
114 print-%:
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
115 @echo $* = $($*)
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
116
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
117 .PHONY: install
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
118 install:
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
119 cp $(MAIN_TARGETS) /usr/local/bin/
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
120