diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-02-18 13:47:17 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-02-18 13:47:17 +0000 |
commit | cdde25b597eb4047e9db27bb8bbcf938e4a43cfe (patch) | |
tree | d25f47817cc8515228c8ea0eb33ab71bfc2159d4 /apps/plugins | |
parent | f436476f9f0eeae4640197866ea5b5fa068df7e9 (diff) | |
download | rockbox-cdde25b597eb4047e9db27bb8bbcf938e4a43cfe.tar.gz rockbox-cdde25b597eb4047e9db27bb8bbcf938e4a43cfe.zip |
Unified build system to use SOURCES for sim builds too, a single Makefile-look
made by configure and various related adjustments. This has not yet been tested
on cygwin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6001 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/Makefile | 41 | ||||
-rw-r--r-- | apps/plugins/lib/Makefile | 7 |
2 files changed, 42 insertions, 6 deletions
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 0c90bde9b1..6af39327bc 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile | |||
@@ -24,16 +24,19 @@ LDS := plugin.lds | |||
24 | LINKFILE := $(OBJDIR)/pluginlink.lds | 24 | LINKFILE := $(OBJDIR)/pluginlink.lds |
25 | DEPFILE = $(OBJDIR)/dep-plugins | 25 | DEPFILE = $(OBJDIR)/dep-plugins |
26 | 26 | ||
27 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) \ | 27 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ |
28 | $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - ) | 28 | $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
29 | ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock) | 29 | ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock) |
30 | SOURCES = $(SRC) | 30 | SOURCES = $(SRC) |
31 | ELFS := $(SRC:%.c=$(OBJDIR)/%.elf) | 31 | ELFS := $(SRC:%.c=$(OBJDIR)/%.elf) |
32 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | 32 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
33 | # as created by the cross-compiler for win32: | ||
34 | DEFS := $(SRC:%.c=$(OBJDIR)/%.def) | ||
33 | DIRS = . | 35 | DIRS = . |
34 | 36 | ||
35 | all: $(OBJDIR)/libplugin.a $(ROCKS) $(DEPFILE) | 37 | all: $(OBJDIR)/libplugin.a $(ROCKS) $(DEPFILE) |
36 | 38 | ||
39 | ifndef SIMVER | ||
37 | $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a | 40 | $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a |
38 | @echo "LD $@" | 41 | @echo "LD $@" |
39 | @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(OBJDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map | 42 | @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(OBJDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map |
@@ -41,6 +44,37 @@ $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a | |||
41 | $(OBJDIR)/%.rock : $(OBJDIR)/%.elf | 44 | $(OBJDIR)/%.rock : $(OBJDIR)/%.elf |
42 | @echo "OBJCOPY $<" | 45 | @echo "OBJCOPY $<" |
43 | @$(OC) -O binary $< $@ | 46 | @$(OC) -O binary $< $@ |
47 | else | ||
48 | |||
49 | ifeq ($(SIMVER), x11) | ||
50 | ################################################### | ||
51 | # This is the X11 simulator version | ||
52 | |||
53 | $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h | ||
54 | @echo "LD $@" | ||
55 | @$(CC) $(APPCFLAGS) -DPLUGIN -shared $< -L$(OBJDIR) -lplugin -o $@ | ||
56 | ifeq ($(UNAME),CYGWIN) | ||
57 | # 'x' must be kept or you'll have "Win32 error 5" | ||
58 | # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 | ||
59 | # #define ERROR_ACCESS_DENIED 5L | ||
60 | else | ||
61 | @chmod -x $@ | ||
62 | endif | ||
63 | |||
64 | else # end of x11-simulator | ||
65 | ################################################### | ||
66 | # This is the win32 simulator version | ||
67 | DLLTOOLFLAGS = --export-all | ||
68 | DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin | ||
69 | |||
70 | $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h | ||
71 | @echo "DLL $@" | ||
72 | @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< | ||
73 | @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ | ||
74 | @chmod -x $@ | ||
75 | endif # end of win32-simulator | ||
76 | |||
77 | endif # end of simulator section | ||
44 | 78 | ||
45 | include $(TOOLSDIR)/make.inc | 79 | include $(TOOLSDIR)/make.inc |
46 | 80 | ||
@@ -56,7 +90,8 @@ $(LINKFILE): $(LDS) | |||
56 | 90 | ||
57 | clean: | 91 | clean: |
58 | @echo "cleaning plugins" | 92 | @echo "cleaning plugins" |
59 | @rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) $(OBJS) | 93 | @rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) \ |
94 | $(OBJS) $(DEFS) | ||
60 | @$(MAKE) -C lib clean | 95 | @$(MAKE) -C lib clean |
61 | 96 | ||
62 | -include $(DEPFILE) | 97 | -include $(DEPFILE) |
diff --git a/apps/plugins/lib/Makefile b/apps/plugins/lib/Makefile index b9daf737c4..b492bb578f 100644 --- a/apps/plugins/lib/Makefile +++ b/apps/plugins/lib/Makefile | |||
@@ -18,9 +18,9 @@ INCLUDES += -I$(APPSDIR)/$(APPEXTRA) | |||
18 | endif | 18 | endif |
19 | 19 | ||
20 | CFLAGS = $(GCCOPTS) \ | 20 | CFLAGS = $(GCCOPTS) \ |
21 | $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} | 21 | $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DPLUGIN |
22 | 22 | ||
23 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - ) | 23 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
24 | SOURCES = $(SRC) | 24 | SOURCES = $(SRC) |
25 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | 25 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
26 | DEPFILE = $(OBJDIR)/dep-pluginlib | 26 | DEPFILE = $(OBJDIR)/dep-pluginlib |
@@ -31,8 +31,9 @@ OUTPUT = $(OBJDIR)/libplugin.a | |||
31 | all: $(OUTPUT) | 31 | all: $(OUTPUT) |
32 | 32 | ||
33 | $(OUTPUT): $(OBJS) | 33 | $(OUTPUT): $(OBJS) |
34 | @echo "AR $@" | 34 | @echo "AR+RANLIB $@" |
35 | @$(AR) ruv $@ $+ >/dev/null 2>&1 | 35 | @$(AR) ruv $@ $+ >/dev/null 2>&1 |
36 | @$(RANLIB) $@ | ||
36 | 37 | ||
37 | include $(TOOLSDIR)/make.inc | 38 | include $(TOOLSDIR)/make.inc |
38 | 39 | ||