Makefiles: Tweaks for Debian
[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 ../../include.mk
74
75 # TOOLCHAIN
76 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
77 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
78 ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
79 ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
80 ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
81 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
82
83 # FLAGS
84
85 CFLAGS += -fmessage-length=0 -Os -m32 $(FPIC) -w \
86          -DECERE_STATIC
87
88 CECFLAGS =
89
90 ECFLAGS = -nolinenumbers
91
92 OFLAGS += -m32 \
93          -L../../ecere/obj/vanilla.$(PLATFORM) \
94          -L../../deps/zlib/obj/release.$(PLATFORM)
95
96 LIBS = -lecereVanilla -lz $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
97
98 UPXFLAGS = -9 -q --no-progress --no-color
99
100 # HARD CODED PLATFORM-SPECIFIC OPTIONS
101 ifdef LINUX
102 OFLAGS += -Wl,--no-undefined
103 endif
104
105 # PLATFORM-SPECIFIC OPTIONS
106
107 ifdef WINDOWS
108
109 LIBS += -lmpr -lwinmm -limm32
110
111 else
112 ifdef LINUX
113
114 OFLAGS += \
115          -L/usr/X11R6/lib
116
117 LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
118
119 else
120 ifdef OSX
121
122 OFLAGS += \
123          -L/usr/X11R6/lib
124
125 LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
126
127 endif
128 endif
129 endif
130
131 # TARGETS
132
133 all: objdir $(TARGET)
134
135 objdir:
136         $(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))
137
138 $(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)
139         $(ECS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols obj/$(CONFIG).$(PLATFORM) -o $(OBJ)$(MODULE).main.ec
140
141 $(OBJ)$(MODULE).main.c: $(OBJ)$(MODULE).main.ec
142         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)
143         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)
144
145 $(SYMBOLS): | objdir
146 $(OBJECTS): | objdir
147 $(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir
148         $(CC) $(OFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(INSTALLNAME)
149 ifndef NOSTRIP
150         $(STRIP) $(STRIPOPT) $(TARGET)
151 endif
152 ifndef WINDOWS
153 ifeq "$(TARGET_TYPE)" "executable"
154         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
155 endif
156 else
157         @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
158 endif
159         $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/actions/folderNew.png ../../ecere/res/vanilla/ecere/actions/goUp.png "ecere/actions"
160         $(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"
161         $(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"
162         $(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"
163         $(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"
164         $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/status/folderOpen.png "ecere/status"
165         $(EAR) awq $(TARGET) locale/zh_CN/LC_MESSAGES/extract.mo "locale/zh_CN/LC_MESSAGES"
166         $(EAR) awq $(TARGET) locale/es_ES/LC_MESSAGES/extract.mo "locale/es_ES/LC_MESSAGES"
167
168 # SYMBOL RULES
169
170 $(OBJ)extract.sym: extract.ec
171         $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c extract.ec -o $(OBJ)extract.sym
172
173 # C OBJECT RULES
174
175 $(OBJ)extract.c: extract.ec $(OBJ)extract.sym | $(SYMBOLS)
176         $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c extract.ec -o $(OBJ)extract.c -symbols $(OBJ)
177
178 # IMPLICIT OBJECT RULE
179
180 $(OBJ)%$(O) : $(OBJ)%.c
181         $(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@
182
183 # OBJECT RULES
184
185 $(OBJ)$(MODULE).main$(O): $(OBJ)$(MODULE).main.c
186         $(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.c -o $(OBJ)$(MODULE).main$(O)
187
188 clean: objdir
189         $(call rmq,$(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S) $(TARGET))
190         $(call rmq,$(OBJECTS))
191         $(call rmq,$(COBJECTS))
192         $(call rmq,$(IMPORTS))
193         $(call rmq,$(SYMBOLS))
194
195 realclean:
196         $(call rmrq,$(OBJ))
197
198 distclean:
199         $(call rmrq,obj/)