Updated our source code header to explicitly mention that we are GPL v2 or
[Rockbox.git] / apps / plugins / clock / Makefile
blobabf932a6827b9306fce19dd39c965d01173d8e36
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $$Id: $$
10 INCLUDES = -I$(APPSDIR) -I.. -I. -I$(APPSDIR)/plugins/lib \
11 $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
12 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
13 -I$(BUILDDIR)/pluginbitmaps
14 CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
15 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
17 ifdef APPEXTRA
18 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
19 endif
21 LINKFILE := $(OBJDIR)/link.lds
22 DEPFILE = $(OBJDIR)/dep-clock
24 # This sets up 'SRC' based on the files mentioned in SOURCES
25 include $(TOOLSDIR)/makesrc.inc
27 SOURCES = $(SRC)
28 OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
29 DIRS = .
31 ifndef SIMVER
32 LDS := ../plugin.lds
33 OUTPUT = $(OUTDIR)/clock.rock
34 else ## simulators
35 OUTPUT = $(OUTDIR)/clock.rock
36 endif
38 all: $(OUTPUT)
40 ifndef SIMVER
41 $(OBJDIR)/clock.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
42 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
43 $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/clock.map
45 $(OUTPUT): $(OBJDIR)/clock.elf
46 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
47 else
49 ifeq ($(SIMVER), x11)
50 ###################################################
51 # This is the X11 simulator version
53 $(OUTPUT): $(OBJS)
54 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
55 ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
56 # 'x' must be kept or you'll have "Win32 error 5"
57 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
58 # #define ERROR_ACCESS_DENIED 5L
59 else
60 @chmod -x $@
61 endif
63 else # end of x11-simulator
64 ifeq ($(SIMVER), sdl)
65 ###################################################
66 # This is the SDL simulator version
68 $(OUTPUT): $(OBJS)
69 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
70 ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
71 # 'x' must be kept or you'll have "Win32 error 5"
72 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
73 # #define ERROR_ACCESS_DENIED 5L
74 else
75 @chmod -x $@
76 endif
78 else # end of sdl-simulator
79 ###################################################
80 # This is the win32 simulator version
81 DLLTOOLFLAGS = --export-all
82 DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
84 $(OUTPUT): $(OBJS)
85 $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
86 $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
87 $(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
88 ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
89 # 'x' must be kept or you'll have "Win32 error 5"
90 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
91 # #define ERROR_ACCESS_DENIED 5L
92 else
93 @chmod -x $@
94 endif
95 endif # end of win32-simulator
96 endif
97 endif # end of simulator section
100 include $(TOOLSDIR)/make.inc
102 # MEMORYSIZE should be passed on to this makefile with the chosen memory size
103 # given in number of MB
104 $(LINKFILE): $(LDS)
105 $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
106 $(DEFINES) -E -P - >$@
108 clean:
109 $(call PRINTS,cleaning clock)rm -rf $(OBJDIR)/clock
110 $(SILENT)rm -f $(OBJDIR)/clock.* $(DEPFILE)
112 -include $(DEPFILE)