annotate Makefile @ 65:05f1a31f8f1e lwtools-4.0

Set version to 4.0
author lost@l-w.ca
date Fri, 08 Apr 2011 21:36:53 -0600
parents 87590f43e76d
children 87026ec7e1c2
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
65
05f1a31f8f1e Set version to 4.0
lost@l-w.ca
parents: 25
diff changeset
19 CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.0"'
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
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
73 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
74 $(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
75
17
4969bd6f3b7d Fixed up glitch with Makefile causing binaries to always be considered out of date
lost@l-w.ca
parents: 16
diff changeset
76 #.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
77 .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
78 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
79
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
80 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
81 @echo Linking $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
82 @$(AR) rc $@ $(lwlib_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
83 @$(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
84
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 %.d: %.c
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
86 @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
87 @$(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
88 @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
89 @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
90 @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
91 @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
92
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
93 alldeps := $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) ($lwobjdump_deps)
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
94
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
95 -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
96
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 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
98
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
99 %.o: %.c
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
100 @echo Building $@
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
101 @$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
102
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
103
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
104 .PHONY: clean
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
105 clean: $(cleantargs)
11
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
106 @echo "Cleaning up"
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
107 @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
108 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs)
a0317b794b7b Make output tidying
lost@l-w.ca
parents: 10
diff changeset
109 @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
110 @rm -f */*.exe
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
111
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
112 .PHONY: realclean
22
7c35fa8dbc91 Added initial framework for lwbasic
lost@l-w.ca
parents: 20
diff changeset
113 realclean: clean $(realcleantargs)
16
2f98cf1558e1 Added building of manual from docbook source to Makefile
lost@l-w.ca
parents: 11
diff changeset
114 @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
115 @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
116 @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
117
2
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
118 print-%:
7317fbe024af Clean up insane number of compiler warnings under -Wall
lost@l-w.ca
parents: 1
diff changeset
119 @echo $* = $($*)
3
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
120
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
121 .PHONY: install
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
122 install:
d4eb3c328a47 Typo fixes
lost@l-w.ca
parents: 2
diff changeset
123 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
124