buildsystem,ide,epj2make; sorted out platform variables and uses. now using HOST_PLAT...
[sdk] / ear / extract / Makefile
1 .PHONY: all objdir clean realclean distclean
2
3 # CONTENT
4
5 MODULE := extract
6 CONFIG := release
7 COMPILER := default
8 TARGET_TYPE = executable
9
10 OBJ = obj/$(CONFIG).$(PLATFORM)/
11
12 RES = 
13
14 CONSOLE = -mwindows
15
16 TARGET = obj/$(CONFIG).$(PLATFORM)/extract$(E)
17
18 OBJECTS = \
19         $(OBJ)extract.o \
20         $(OBJ)$(MODULE).main$(O)
21
22 COBJECTS = \
23         $(OBJ)extract.c
24
25 SYMBOLS = \
26         $(OBJ)extract.sym
27
28 IMPORTS = \
29         $(OBJ)extract.imp
30
31 SOURCES = \
32         extract.ec
33
34 RESOURCES = $(RESOURCES1) $(RESOURCES2)
35 RESOURCES1 = \
36         ../../ecere/res/vanilla/ecere/actions/folderNew.png \
37         ../../ecere/res/vanilla/ecere/actions/goUp.png \
38         ../../ecere/res/vanilla/ecere/devices/computer.png \
39         ../../ecere/res/vanilla/ecere/devices/driveHardDisk.png \
40         ../../ecere/res/vanilla/ecere/devices/driveRemovableMedia.png \
41         ../../ecere/res/vanilla/ecere/devices/mediaFloppy.png \
42         ../../ecere/res/vanilla/ecere/devices/mediaOptical.png \
43         ../../ecere/res/vanilla/ecere/elements/areaClose.png \
44         ../../ecere/res/vanilla/ecere/elements/areaMaximize.png \
45         ../../ecere/res/vanilla/ecere/elements/areaMinimize.png \
46         ../../ecere/res/vanilla/ecere/elements/areaRestore.png \
47         ../../ecere/res/vanilla/ecere/elements/arrowDown.png \
48         ../../ecere/res/vanilla/ecere/elements/arrowLeft.png \
49         ../../ecere/res/vanilla/ecere/elements/arrowRight.png \
50         ../../ecere/res/vanilla/ecere/elements/arrowUp.png \
51         ../../ecere/res/vanilla/ecere/elements/optionBoxDisabledSelected.png \
52         ../../ecere/res/vanilla/ecere/elements/optionBoxDown.png \
53         ../../ecere/res/vanilla/ecere/elements/optionBoxSelected.png \
54         ../../ecere/res/vanilla/ecere/elements/optionBoxSelectedDown.png \
55         ../../ecere/res/vanilla/ecere/elements/optionBoxUp.png \
56         ../../ecere/res/vanilla/ecere/places/driveRemote.png \
57         ../../ecere/res/vanilla/ecere/places/folder.png \
58         ../../ecere/res/vanilla/ecere/places/folderRemote.png \
59         ../../ecere/res/vanilla/ecere/places/networkServer.png \
60         ../../ecere/res/vanilla/ecere/places/networkWorkgroup.png \
61         ../../ecere/res/vanilla/ecere/status/folderOpen.png \
62         locale/zh_CN/LC_MESSAGES/extract.mo
63 RESOURCES2 = \
64         locale/es_ES/LC_MESSAGES/extract.mo
65
66 ifndef DEBIAN_PACKAGE
67 CFLAGS =
68 endif
69 OFLAGS =
70
71 # CROSS-PLATFORM MAGIC
72
73 include ../../crossplatform.mk
74 include ../../include.mk
75
76 # TOOLCHAIN
77 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
78 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
79 ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
80 ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
81 ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
82 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
83
84 # FLAGS
85
86 CFLAGS += -fmessage-length=0 -Os -m32 $(FPIC) -w \
87          -DECERE_STATIC
88
89 CECFLAGS =
90
91 ECFLAGS = -nolinenumbers
92
93 OFLAGS += -m32 \
94          -L../../ecere/obj/vanilla.$(PLATFORM) \
95          -L../../deps/zlib/obj/release.$(PLATFORM)
96
97 LIBS = -lecereVanilla -lz $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
98
99 UPXFLAGS = -9 -q --no-progress --no-color
100
101 # HARD CODED PLATFORM-SPECIFIC OPTIONS
102 ifdef LINUX_TARGET
103 OFLAGS += -Wl,--no-undefined
104 endif
105
106 # PLATFORM-SPECIFIC OPTIONS
107
108 ifdef WINDOWS_TARGET
109
110 LIBS += -lmpr -lwinmm -limm32
111
112 else
113 ifdef LINUX_TARGET
114
115 OFLAGS += \
116          -L/usr/X11R6/lib
117
118 LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
119
120 else
121 ifdef OSX_TARGET
122
123 OFLAGS += \
124          -L/usr/X11R6/lib
125
126 LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
127
128 endif
129 endif
130 endif
131
132 # TARGETS
133
134 all: objdir $(TARGET)
135
136 objdir:
137         $(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))
138
139 $(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)
140         $(ECS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols obj/$(CONFIG).$(PLATFORM) -o $(OBJ)$(MODULE).main.ec
141
142 $(OBJ)$(MODULE).main.c: $(OBJ)$(MODULE).main.ec
143         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)
144         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)
145
146 $(SYMBOLS): | objdir
147 $(OBJECTS): | objdir
148 $(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir
149         $(CC) $(OFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(INSTALLNAME)
150 ifndef NOSTRIP
151         $(STRIP) $(STRIPOPT) $(TARGET)
152 endif
153 ifndef WINDOWS_TARGET
154 ifeq "$(TARGET_TYPE)" "executable"
155         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
156 endif
157 else
158         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
159 endif
160         $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/actions/folderNew.png ../../ecere/res/vanilla/ecere/actions/goUp.png "ecere/actions"
161         $(EAR) awq $(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"
162         $(EAR) awq $(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"
163         $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/elements/optionBoxSelected.png ../../ecere/res/vanilla/ecere/elements/optionBoxSelectedDown.png ../../ecere/res/vanilla/ecere/elements/optionBoxUp.png "ecere/elements"
164         $(EAR) awq $(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"
165         $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/status/folderOpen.png "ecere/status"
166         $(EAR) awq $(TARGET) locale/zh_CN/LC_MESSAGES/extract.mo "locale/zh_CN/LC_MESSAGES"
167         $(EAR) awq $(TARGET) locale/es_ES/LC_MESSAGES/extract.mo "locale/es_ES/LC_MESSAGES"
168
169 # SYMBOL RULES
170
171 $(OBJ)extract.sym: extract.ec
172         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c extract.ec -o $(OBJ)extract.sym
173
174 # C OBJECT RULES
175
176 $(OBJ)extract.c: extract.ec $(OBJ)extract.sym | $(SYMBOLS)
177         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c extract.ec -o $(OBJ)extract.c -symbols $(OBJ)
178
179 # IMPLICIT OBJECT RULE
180
181 $(OBJ)%$(O) : $(OBJ)%.c
182         $(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@
183
184 # OBJECT RULES
185
186 $(OBJ)$(MODULE).main$(O): $(OBJ)$(MODULE).main.c
187         $(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.c -o $(OBJ)$(MODULE).main$(O)
188
189 clean: objdir
190         $(call rmq,$(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S) $(TARGET))
191         $(call rmq,$(OBJECTS))
192         $(call rmq,$(COBJECTS))
193         $(call rmq,$(IMPORTS))
194         $(call rmq,$(SYMBOLS))
195
196 realclean:
197         $(call rmrq,$(OBJ))
198
199 distclean:
200         $(call rmrq,obj/)