|
1 # |
|
2 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # Utility makefile |
|
16 # |
|
17 |
|
18 define cpp2obj |
|
19 OBJECTFILE:=$(OUTPUTPATH)/$(TARGET)/$(notdir $(SOURCEFILE:.cpp=.o)) |
|
20 $$(OBJECTFILE): $(SOURCEFILE) |
|
21 g++ $(HOSTMACROS) $(CFLAGS) -c $(SOURCEFILE) -o $$@ |
|
22 |
|
23 OBJECTS:=$$(OBJECTS) $$(OBJECTFILE) |
|
24 |
|
25 endef |
|
26 |
|
27 define cppprogram |
|
28 |
|
29 all:: $(BINDIR)/$(TARGET)$(PROGRAMEXT) |
|
30 |
|
31 $(foreach SOURCEFILE,$(SOURCES),$(cpp2obj)) |
|
32 |
|
33 $(BINDIR)/$(TARGET)$(PROGRAMEXT): $$(OBJECTS) |
|
34 g++ $(LDFLAGS) $$^ -o $$@ |
|
35 |
|
36 $$(shell mkdir -p $(OUTPUTPATH)/$(TARGET) $(BINDIR)) |
|
37 |
|
38 CLEANFILES:=$$(OBJECTS) |
|
39 $(cleanlog) |
|
40 |
|
41 endef |
|
42 |
|
43 define c2obj |
|
44 OBJECTFILE:=$(OUTPUTPATH)/$(TARGET)/$(notdir $(SOURCEFILE:.c=.o)) |
|
45 $$(OBJECTFILE): $(SOURCEFILE) |
|
46 gcc $(HOSTMACROS) $(CFLAGS) -c $(SOURCEFILE) -o $$@ |
|
47 |
|
48 OBJECTS:=$$(OBJECTS) $$(OBJECTFILE) |
|
49 |
|
50 endef |
|
51 |
|
52 |
|
53 define cprogram |
|
54 |
|
55 OBJECTS:= |
|
56 |
|
57 all:: $(BINDIR)/$(TARGET)$(PROGRAMEXT) |
|
58 |
|
59 .PHONY:: $(TARGET) |
|
60 $(TARGET):: $(BINDIR)/$(TARGET)$(PROGRAMEXT) |
|
61 |
|
62 $(foreach SOURCEFILE,$(SOURCES),$(c2obj)) |
|
63 |
|
64 $(BINDIR)/$(TARGET)$(PROGRAMEXT): $$(OBJECTS) |
|
65 gcc $(LDFLAGS) $$^ -o $$@ |
|
66 |
|
67 $$(shell mkdir -p $(OUTPUTPATH)/$(TARGET)) |
|
68 |
|
69 CLEANFILES:=$$(OBJECTS) |
|
70 $(cleanlog) |
|
71 |
|
72 endef |