diff options
Diffstat (limited to 'apps/plugins/Makefile')
-rw-r--r-- | apps/plugins/Makefile | 41 |
1 files changed, 38 insertions, 3 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) |