Mercurial > hg > index.cgi
comparison Makefile @ 10:127e5b1e01c0
Removed use of asprintf() and added Makefile options for cross compiling; also a bugfix with sizeof{} in lwasm
author | lost@l-w.ca |
---|---|
date | Sat, 22 Jan 2011 10:37:53 -0700 |
parents | 6eed14cccac9 |
children | a0317b794b7b |
comparison
equal
deleted
inserted
replaced
9:6eed14cccac9 | 10:127e5b1e01c0 |
---|---|
1 CPPFLAGS += -I lwlib -D_GNU_SOURCE -DPACKAGE_STRING='"lwtools 4.0-pre"' -DPACKAGE_BUGREPORT='"lost@l-w.ca"' | 1 # define anything system specific here |
2 # | |
3 # set these variables if needed | |
4 # PROGSUFFIX: suffix added to binaries | |
5 # BUILDTPREFIX: prefix added to build utilities (cc, etc.) for xcompile | |
6 # can also set them when invoking "make" | |
7 #PROGSUFFIX := .exe | |
8 #BUILDTPREFIX=i586-mingw32msvc- | |
2 | 9 |
10 # C compiler | |
11 CC := $(BUILDTPREFIX)cc | |
12 | |
13 # ar | |
14 AR := $(BUILDTPREFIX)ar | |
15 | |
16 # ranlib | |
17 RANLIB := $(BUILDTPREFIX)ranlib | |
18 | |
19 CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.0-pre"' | |
3 LDFLAGS += -L$(PWD)/lwlib -llw | 20 LDFLAGS += -L$(PWD)/lwlib -llw |
4 | 21 |
5 MAIN_TARGETS := lwasm/lwasm lwlink/lwlink lwar/lwar lwlink/lwobjdump | 22 |
23 MAIN_TARGETS := lwasm/lwasm$(PROGSUFFIX) \ | |
24 lwlink/lwlink$(PROGSUFFIX) \ | |
25 lwar/lwar$(PROGSUFFIX) \ | |
26 lwlink/lwobjdump$(PROGSUFFIX) | |
6 | 27 |
7 .PHONY: all | 28 .PHONY: all |
8 all: $(MAIN_TARGETS) | 29 all: $(MAIN_TARGETS) |
9 | 30 |
10 subdirs := lwasm lwlink lwar lwlib | 31 subdirs := lwasm lwlink lwar lwlib |
21 lwlink_deps := $(lwlink_srcs:.c=.d) | 42 lwlink_deps := $(lwlink_srcs:.c=.d) |
22 lwar_deps := $(lwar_srcs:.c=.d) | 43 lwar_deps := $(lwar_srcs:.c=.d) |
23 lwlib_deps := $(lwlib_srcs:.c=.d) | 44 lwlib_deps := $(lwlib_srcs:.c=.d) |
24 lwobjdump_deps := $(lwobjdump_srcs:.c=.d) | 45 lwobjdump_deps := $(lwobjdump_srcs:.c=.d) |
25 | 46 |
26 .PHONY: lwlink lwasm lwar lwobjdump | 47 .PHONY: lwlink lwasm lwar lwobjdump$(PROGSUFFIX) |
27 lwlink: lwlink/lwlink | 48 lwlink: lwlink/lwlink$(PROGSUFFIX) |
28 lwasm: lwasm/lwasm | 49 lwasm: lwasm/lwasm$(PROGSUFFIX) |
29 lwar: lwar/lwar | 50 lwar: lwar/lwar$(PROGSUFFIX) |
30 lwobjdump: lwlink/lwobjdump | 51 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) |
31 | 52 |
32 lwasm/lwasm: $(lwasm_objs) lwlib lwasm/rules.make | 53 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib lwasm/rules.make |
33 $(CC) -o $@ $(lwasm_objs) $(LDFLAGS) | 54 $(CC) -o $@ $(lwasm_objs) $(LDFLAGS) |
34 | 55 |
35 lwlink/lwlink: $(lwlink_objs) lwlib lwlink/rules.make | 56 lwlink/lwlink$(PROGSUFFIX): $(lwlink_objs) lwlib lwlink/rules.make |
36 $(CC) -o $@ $(lwlink_objs) $(LDFLAGS) | 57 $(CC) -o $@ $(lwlink_objs) $(LDFLAGS) |
37 | 58 |
38 lwlink/lwobjdump: $(lwobjdump_objs) lwlib lwlink/rules.make | 59 lwlink/lwobjdump$(PROGSUFFIX): $(lwobjdump_objs) lwlib lwlink/rules.make |
39 $(CC) -o $@ $(lwobjdump_objs) $(LDFLAGS) | 60 $(CC) -o $@ $(lwobjdump_objs) $(LDFLAGS) |
40 | 61 |
41 lwar/lwar: $(lwar_objs) lwlib lwar/rules.make | 62 lwar/lwar$(PROGSUFFIX): $(lwar_objs) lwlib lwar/rules.make |
42 $(CC) -o $@ $(lwar_objs) $(LDFLAGS) | 63 $(CC) -o $@ $(lwar_objs) $(LDFLAGS) |
43 | 64 |
44 test: test.c lwlib | 65 test: test.c lwlib |
45 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ test.c $(LDFLAGS) | 66 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ test.c $(LDFLAGS) |
46 | 67 |
47 .PHONY: lwlib | 68 .PHONY: lwlib |
48 lwlib: lwlib/liblw.a | 69 lwlib: lwlib/liblw.a |
49 | 70 |
50 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make | 71 lwlib/liblw.a: $(lwlib_objs) lwlib/rules.make |
51 $(AR) rc $@ $(lwlib_objs) | 72 $(AR) rc $@ $(lwlib_objs) |
73 $(RANLIB) $@ | |
52 | 74 |
53 %.d: %.c | 75 %.d: %.c |
54 # @echo "Building dependencies for $@" | 76 # @echo "Building dependencies for $@" |
55 @$(CC) -MM $(CPPFLAGS) -o $*.d $< | 77 @$(CC) -MM $(CPPFLAGS) -o $*.d $< |
56 @mv -f $*.d $*.d.tmp | 78 @mv -f $*.d $*.d.tmp |
65 extra_clean := $(extra_clean) *~ */*~ | 87 extra_clean := $(extra_clean) *~ */*~ |
66 | 88 |
67 .PHONY: clean | 89 .PHONY: clean |
68 clean: | 90 clean: |
69 rm -f $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) $(lwobjdump_deps) | 91 rm -f $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) $(lwobjdump_deps) |
70 rm -f lwlib/liblw.a lwasm/lwasm lwlink/lwlink lwlink/lwobjdump lwar/lwar | 92 rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) |
71 rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) | 93 rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) |
72 rm -f $(extra_clean) | 94 rm -f $(extra_clean) |
73 | 95 |
74 print-%: | 96 print-%: |
75 @echo $* = $($*) | 97 @echo $* = $($*) |