db351be45e3eac959137bb192b1c2437a3b7a9d3
[sdk] / ear / extract / Makefile
1 .PHONY: all objdir clean realclean distclean
2
3 # CORE VARIABLES
4
5 MODULE := extract
6 CONFIG := release
7 ifndef COMPILER
8 COMPILER := default
9 endif
10
11 TARGET_TYPE = executable
12
13 # FLAGS
14
15 ECFLAGS =
16 ifndef DEBIAN_PACKAGE
17 CFLAGS =
18 endif
19 CECFLAGS =
20 OFLAGS =
21 LDFLAGS =
22 LIBS =
23
24 ifdef DEBUG
25 NOSTRIP := y
26 endif
27
28 ifdef EXECUTABLE_TARGET
29 CONSOLE = -mwindows
30 endif
31
32 # INCLUDES
33
34 _CF_DIR = ../../
35
36 include $(_CF_DIR)crossplatform.mk
37 include $(_CF_DIR)include.mk
38
39 # CUSTOM TOOLCHAIN / COMPILER CONFIG
40
41 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
42 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
43 ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
44 ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
45 ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
46 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
47
48 # END OF CUSTOM TOOLCHAIN / COMPILER CONFIG
49
50 # POST-INCLUDES VARIABLES
51
52 OBJ = obj/$(CONFIG).$(PLATFORM)/
53
54 RES = 
55
56 TARGET = obj/$(CONFIG).$(PLATFORM)/extract$(E)
57
58 _ECSOURCES = \
59         extract.ec
60
61 ECSOURCES = $(call shwspace,$(_ECSOURCES))
62
63 COBJECTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(C),$(notdir $(_ECSOURCES)))))
64
65 SYMBOLS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(S),$(notdir $(_ECSOURCES)))))
66
67 IMPORTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(I),$(notdir $(_ECSOURCES)))))
68
69 ECOBJECTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(O),$(notdir $(_ECSOURCES)))))
70
71 BOWLS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(B),$(notdir $(_ECSOURCES)))))
72
73 OBJECTS = $(ECOBJECTS) $(OBJ)$(MODULE).main$(O)
74
75 SOURCES = $(ECSOURCES)
76
77 RESOURCES = $(RESOURCES1) $(RESOURCES2)
78 RESOURCES1 = \
79         ../../ecere/res/vanilla/ecere/actions/folderNew.png \
80         ../../ecere/res/vanilla/ecere/actions/goUp.png \
81         ../../ecere/res/vanilla/ecere/devices/computer.png \
82         ../../ecere/res/vanilla/ecere/devices/driveHardDisk.png \
83         ../../ecere/res/vanilla/ecere/devices/driveRemovableMedia.png \
84         ../../ecere/res/vanilla/ecere/devices/mediaFloppy.png \
85         ../../ecere/res/vanilla/ecere/devices/mediaOptical.png \
86         ../../ecere/res/vanilla/ecere/elements/areaClose.png \
87         ../../ecere/res/vanilla/ecere/elements/areaMaximize.png \
88         ../../ecere/res/vanilla/ecere/elements/areaMinimize.png \
89         ../../ecere/res/vanilla/ecere/elements/areaRestore.png \
90         ../../ecere/res/vanilla/ecere/elements/arrowDown.png \
91         ../../ecere/res/vanilla/ecere/elements/arrowLeft.png \
92         ../../ecere/res/vanilla/ecere/elements/arrowRight.png \
93         ../../ecere/res/vanilla/ecere/elements/arrowUp.png \
94         ../../ecere/res/vanilla/ecere/elements/optionBoxDisabledSelected.png \
95         ../../ecere/res/vanilla/ecere/elements/optionBoxDown.png \
96         ../../ecere/res/vanilla/ecere/elements/optionBoxSelected.png \
97         ../../ecere/res/vanilla/ecere/elements/optionBoxSelectedDown.png \
98         ../../ecere/res/vanilla/ecere/elements/optionBoxUp.png \
99         ../../ecere/res/vanilla/ecere/places/driveRemote.png \
100         ../../ecere/res/vanilla/ecere/places/folder.png \
101         ../../ecere/res/vanilla/ecere/places/folderRemote.png \
102         ../../ecere/res/vanilla/ecere/places/networkServer.png \
103         ../../ecere/res/vanilla/ecere/places/networkWorkgroup.png \
104         ../../ecere/res/vanilla/ecere/status/folderOpen.png \
105         locale/zh_CN/LC_MESSAGES/extract.mo
106 RESOURCES2 = \
107         locale/es_ES/LC_MESSAGES/extract.mo
108
109 LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
110
111 ifndef STATIC_LIBRARY_TARGET
112 LIBS += \
113         $(call _L,ecereVanilla) \
114         $(call _L,z)
115 endif
116
117 CFLAGS += \
118          $(if $(DEBIAN_PACKAGE),$(CPPFLAGS),) $(if $(DEBUG), -D_DEBUG,) \
119          $(if $(DEBUG), -g, -Os) $(FORCE_32_BIT) $(FPIC) -w \
120                          -DECERE_STATIC
121
122
123 ECFLAGS += \
124          -nolinenumbers
125
126
127 # PLATFORM-SPECIFIC OPTIONS
128
129 ifdef WINDOWS_TARGET
130
131 ifndef STATIC_LIBRARY_TARGET
132 LIBS += \
133         $(call _L,mpr) \
134         $(call _L,winmm) \
135         $(call _L,imm32) \
136         $(call _L,gdi32)
137 endif
138
139 else
140 ifdef LINUX_TARGET
141
142 ifndef STATIC_LIBRARY_TARGET
143 OFLAGS += \
144          -L/usr/X11R6/lib
145 LIBS += \
146         $(call _L,fontconfig) \
147         $(call _L,freetype) \
148         $(call _L,Xrender) \
149         $(call _L,Xext) \
150         $(call _L,ncurses) \
151         $(call _L,m) \
152         $(call _L,dl) \
153         $(call _L,pthread) \
154         $(call _L,X11)
155 endif
156
157 else
158 ifdef OSX_TARGET
159
160 ifndef STATIC_LIBRARY_TARGET
161 OFLAGS += \
162          -L/usr/X11R6/lib
163 LIBS += \
164         $(call _L,fontconfig) \
165         $(call _L,freetype) \
166         $(call _L,Xrender) \
167         $(call _L,Xext) \
168         $(call _L,ncurses) \
169         $(call _L,m) \
170         $(call _L,dl) \
171         $(call _L,pthread) \
172         $(call _L,X11)
173 endif
174
175 endif
176 endif
177 endif
178
179
180
181 CECFLAGS += -cpp $(CPP)
182
183 ifndef STATIC_LIBRARY_TARGET
184 OFLAGS += $(FORCE_32_BIT) \
185          -L../../ecere/obj/vanilla.$(PLATFORM) \
186          -L../../deps/zlib/obj/release.$(PLATFORM)
187 OFLAGS += $(LDFLAGS)
188 endif
189
190 # TARGETS
191
192 all: objdir $(TARGET)
193
194 objdir:
195         $(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))
196
197 $(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)
198         $(ECS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols obj/$(CONFIG).$(PLATFORM) -o $(OBJ)$(MODULE).main.ec
199
200 $(OBJ)$(MODULE).main.c: $(OBJ)$(MODULE).main.ec
201         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)
202         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)
203
204 $(SYMBOLS): | objdir
205 $(OBJECTS): | objdir
206 $(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir
207 ifndef STATIC_LIBRARY_TARGET
208         $(CC) $(OFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(INSTALLNAME)
209 ifndef NOSTRIP
210         $(STRIP) $(STRIPOPT) $(TARGET)
211 endif
212 ifndef WINDOWS_TARGET
213 ifdef EXECUTABLE_TARGET
214         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
215 endif
216 else
217         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
218 endif
219         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/actions/folderNew.png ../../ecere/res/vanilla/ecere/actions/goUp.png "ecere/actions"
220         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/devices/computer.png ../../ecere/res/vanilla/ecere/devices/driveHardDisk.png ../../ecere/res/vanilla/ecere/devices/driveRemovableMedia.png ../../ecere/res/vanilla/ecere/devices/mediaFloppy.png ../../ecere/res/vanilla/ecere/devices/mediaOptical.png "ecere/devices"
221         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/elements/areaClose.png ../../ecere/res/vanilla/ecere/elements/areaMaximize.png ../../ecere/res/vanilla/ecere/elements/areaMinimize.png ../../ecere/res/vanilla/ecere/elements/areaRestore.png ../../ecere/res/vanilla/ecere/elements/arrowDown.png ../../ecere/res/vanilla/ecere/elements/arrowLeft.png ../../ecere/res/vanilla/ecere/elements/arrowRight.png ../../ecere/res/vanilla/ecere/elements/arrowUp.png ../../ecere/res/vanilla/ecere/elements/optionBoxDisabledSelected.png ../../ecere/res/vanilla/ecere/elements/optionBoxDown.png "ecere/elements"
222         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/elements/optionBoxSelected.png ../../ecere/res/vanilla/ecere/elements/optionBoxSelectedDown.png ../../ecere/res/vanilla/ecere/elements/optionBoxUp.png "ecere/elements"
223         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/places/driveRemote.png ../../ecere/res/vanilla/ecere/places/folder.png ../../ecere/res/vanilla/ecere/places/folderRemote.png ../../ecere/res/vanilla/ecere/places/networkServer.png ../../ecere/res/vanilla/ecere/places/networkWorkgroup.png "ecere/places"
224         $(EAR) $(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/status/folderOpen.png "ecere/status"
225         $(EAR) $(EARFLAGS) $(TARGET) locale/zh_CN/LC_MESSAGES/extract.mo "locale/zh_CN/LC_MESSAGES"
226         $(EAR) $(EARFLAGS) $(TARGET) locale/es_ES/LC_MESSAGES/extract.mo "locale/es_ES/LC_MESSAGES"
227 else
228         $(AR) rcs $(TARGET) $(OBJECTS) $(LIBS)
229 endif
230
231 # SYMBOL RULES
232
233 $(OBJ)extract.sym: extract.ec
234         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c extract.ec -o $(OBJ)extract.sym
235
236 # C OBJECT RULES
237
238 $(OBJ)extract.c: extract.ec $(OBJ)extract.sym | $(SYMBOLS)
239         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c extract.ec -o $(OBJ)extract.c -symbols $(OBJ)
240
241 # OBJECT RULES
242
243 $(OBJ)extract.o: $(OBJ)extract.c
244         $(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)extract.c -o $(OBJ)extract.o
245
246 $(OBJ)$(MODULE).main$(O): $(OBJ)$(MODULE).main.c
247         $(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.c -o $(OBJ)$(MODULE).main$(O)
248
249 clean: objdir
250         $(call rmq,$(OBJ)$(MODULE).main.o $(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S) $(TARGET))
251         $(call rmq,$(_OBJECTS))
252         $(call rmq,$(ECOBJECTS))
253         $(call rmq,$(COBJECTS))
254         $(call rmq,$(BOWLS))
255         $(call rmq,$(IMPORTS))
256         $(call rmq,$(SYMBOLS))
257
258 realclean: clean
259         $(call rmrq,$(OBJ))
260
261 distclean:
262         $(call rmrq,obj/)