deps: zlib-1.2.3 -> 1.2.8; libpng-1.4.0 -> 1.6.12
[sdk] / ear / extract / Makefile
index 800a80c..69c34e3 100644 (file)
@@ -1,37 +1,70 @@
-.PHONY: all objdir clean realclean distclean
+.PHONY: all objdir cleantarget clean realclean distclean
 
-# CONTENT
+# CORE VARIABLES
 
 MODULE := extract
 CONFIG := release
+ifndef COMPILER
 COMPILER := default
+endif
+
 TARGET_TYPE = executable
 
-OBJ = obj/$(CONFIG).$(PLATFORM)/
+# FLAGS
 
-RES = 
+ECFLAGS =
+ifndef DEBIAN_PACKAGE
+CFLAGS =
+LDFLAGS =
+endif
+PRJ_CFLAGS =
+CECFLAGS =
+OFLAGS =
+LIBS =
+
+ifdef DEBUG
+NOSTRIP := y
+endif
 
 CONSOLE = -mwindows
 
-TARGET = obj/$(CONFIG).$(PLATFORM)/extract$(E)
+# INCLUDES
+
+_CF_DIR = ../../
+USE_BOOTSTRAP := defined
+
+include $(_CF_DIR)crossplatform.mk
+include $(_CF_DIR)default.cf
 
-OBJECTS = \
-       $(OBJ)extract.o \
-       $(OBJ)$(MODULE).main$(O)
+# POST-INCLUDES VARIABLES
 
-COBJECTS = \
-       $(OBJ)extract.c
+OBJ = obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)/
 
-SYMBOLS = \
-       $(OBJ)extract.sym
+RES = 
 
-IMPORTS = \
-       $(OBJ)extract.imp
+TARGET = obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)/extract$(E)
 
-SOURCES = \
+_ECSOURCES = \
        extract.ec
 
-RESOURCES = \
+ECSOURCES = $(call shwspace,$(_ECSOURCES))
+
+COBJECTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(C),$(notdir $(_ECSOURCES)))))
+
+SYMBOLS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(S),$(notdir $(_ECSOURCES)))))
+
+IMPORTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(I),$(notdir $(_ECSOURCES)))))
+
+ECOBJECTS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(O),$(notdir $(_ECSOURCES)))))
+
+BOWLS = $(call shwspace,$(addprefix $(OBJ),$(patsubst %.ec,%$(B),$(notdir $(_ECSOURCES)))))
+
+OBJECTS = $(ECOBJECTS) $(OBJ)$(MODULE).main$(O)
+
+SOURCES = $(ECSOURCES)
+
+RESOURCES = $(RESOURCES1) $(RESOURCES2)
+RESOURCES1 = \
        ../../ecere/res/vanilla/ecere/actions/folderNew.png \
        ../../ecere/res/vanilla/ecere/actions/goUp.png \
        ../../ecere/res/vanilla/ecere/devices/computer.png \
@@ -57,68 +90,96 @@ RESOURCES = \
        ../../ecere/res/vanilla/ecere/places/folderRemote.png \
        ../../ecere/res/vanilla/ecere/places/networkServer.png \
        ../../ecere/res/vanilla/ecere/places/networkWorkgroup.png \
-       ../../ecere/res/vanilla/ecere/status/folderOpen.png
-
-# CROSS-PLATFORM MAGIC
-
-include ../../include.mk
-
-# TOOLCHAIN
-export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
-ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
-ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
-EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
-
-# FLAGS
-
-CFLAGS = -fmessage-length=0 -Os -m32 $(FPIC) -w \
-        -DECERE_STATIC
-
-CECFLAGS =
-
-ECFLAGS = -nolinenumbers
-
-OFLAGS = -m32 \
-        -L../../ecere/obj/vanilla.$(PLATFORM) \
-        -L../../deps/zlib/obj/release.$(PLATFORM)
-
-LIBS = -lecereVanilla -lz $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
+       ../../ecere/res/vanilla/ecere/status/folderOpen.png \
+       ../../ecere/locale/es.mo
+RESOURCES2 = \
+       ../../ecere/locale/hu.mo \
+       ../../ecere/locale/mr.mo \
+       ../../ecere/locale/nl.mo \
+       ../../ecere/locale/pt_BR.mo \
+       ../../ecere/locale/ru.mo \
+       ../../ecere/locale/zh_CN.mo \
+       locale/es.mo \
+       locale/he.mo \
+       locale/ru.mo \
+       locale/zh_CN.mo
+
+LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
+
+ifndef STATIC_LIBRARY_TARGET
+LIBS += \
+       $(call _L,ecereVanilla) \
+       $(call _L,z)
+endif
 
-UPXFLAGS = -9 -q --no-progress --no-color
+PRJ_CFLAGS += \
+        $(if $(DEBUG), -g, -Os) $(FPIC) -w \
+                        -DECERE_STATIC
 
-# HARD CODED PLATFORM-SPECIFIC OPTIONS
-ifdef LINUX
-OFLAGS += -Wl,--no-undefined
-endif
+ECFLAGS += -module $(MODULE)
+ECFLAGS += \
+        -nolinenumbers
 
 # PLATFORM-SPECIFIC OPTIONS
 
-ifdef WINDOWS
+ifdef WINDOWS_TARGET
 
-LIBS += -lmpr -lwinmm -limm32
+ifndef STATIC_LIBRARY_TARGET
+LIBS += \
+       $(call _L,mpr) \
+       $(call _L,winmm) \
+       $(call _L,imm32) \
+       $(call _L,gdi32)
+endif
 
 else
-ifdef LINUX
+ifdef LINUX_TARGET
 
+ifndef STATIC_LIBRARY_TARGET
 OFLAGS += \
         -L/usr/X11R6/lib
-
-LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
+LIBS += \
+       $(call _L,fontconfig) \
+       $(call _L,freetype) \
+       $(call _L,Xrender) \
+       $(call _L,Xext) \
+       $(call _L,ncurses) \
+       $(call _L,m) \
+       $(call _L,dl) \
+       $(call _L,pthread) \
+       $(call _L,X11)
+endif
 
 else
-ifdef OSX
+ifdef OSX_TARGET
 
+ifndef STATIC_LIBRARY_TARGET
 OFLAGS += \
         -L/usr/X11R6/lib
-
-LIBS += -lfontconfig -lfreetype -lXrender -lXext -lncurses -lm -ldl -lpthread -lX11
+LIBS += \
+       $(call _L,fontconfig) \
+       $(call _L,freetype) \
+       $(call _L,Xrender) \
+       $(call _L,Xext) \
+       $(call _L,ncurses) \
+       $(call _L,m) \
+       $(call _L,dl) \
+       $(call _L,pthread) \
+       $(call _L,X11)
+endif
 
 endif
 endif
 endif
 
+CECFLAGS += -cpp $(_CPP)
+
+ifndef STATIC_LIBRARY_TARGET
+OFLAGS += \
+        -L../../ecere/obj/vanilla.$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX) \
+        -L../../deps/zlib-1.2.8/obj/release.$(PLATFORM)$(COMPILER_SUFFIX)
+endif
+
 # TARGETS
 
 all: objdir $(TARGET)
@@ -127,60 +188,81 @@ objdir:
        $(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))
 
 $(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)
-       $(ECS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols obj/$(CONFIG).$(PLATFORM) -o $(OBJ)$(MODULE).main.ec
+       $(ECS) $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX) -o $(OBJ)$(MODULE).main.ec
 
 $(OBJ)$(MODULE).main.c: $(OBJ)$(MODULE).main.ec
-       $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)
-       $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)
+       $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)
+       $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)
 
 $(SYMBOLS): | objdir
 $(OBJECTS): | objdir
 $(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir
+ifndef STATIC_LIBRARY_TARGET
        $(CC) $(OFLAGS) $(OBJECTS) $(LIBS) -o $(TARGET) $(INSTALLNAME)
+ifndef NOSTRIP
        $(STRIP) $(STRIPOPT) $(TARGET)
-ifndef WINDOWS
-ifeq "$(TARGET_TYPE)" "executable"
-       @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
 endif
+ifndef WINDOWS_TARGET
+ifdef EXECUTABLE_TARGET
+       @-$(call sys_path,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
+endif
+else
+       @-$(call sys_path,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
+endif
+       $(EAR) aw$(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/actions/folderNew.png ../../ecere/res/vanilla/ecere/actions/goUp.png "ecere/actions"
+       $(EAR) aw$(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"
+       $(EAR) aw$(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"
+       $(EAR) aw$(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"
+       $(EAR) aw$(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"
+       $(EAR) aw$(EARFLAGS) $(TARGET) ../../ecere/res/vanilla/ecere/status/folderOpen.png "ecere/status"
+       $(EAR) aw$(EARFLAGS) $(TARGET) ../../ecere/locale/es.mo ../../ecere/locale/hu.mo ../../ecere/locale/mr.mo ../../ecere/locale/nl.mo ../../ecere/locale/pt_BR.mo ../../ecere/locale/ru.mo ../../ecere/locale/zh_CN.mo "ecere/locale"
+       $(EAR) aw$(EARFLAGS) $(TARGET) locale/es.mo locale/he.mo locale/ru.mo locale/zh_CN.mo "locale"
 else
-       @-$(call psep,$(UPX) $(UPXFLAGS) $(TARGET)) || $(call echo,upx not installed; not compressing.)
+       $(AR) rcs $(TARGET) $(OBJECTS) $(LIBS)
 endif
-       $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/actions/folderNew.png ../../ecere/res/vanilla/ecere/actions/goUp.png "ecere/actions"
-       $(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"
-       $(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"
-       $(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"
-       $(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"
-       $(EAR) awq $(TARGET) ../../ecere/res/vanilla/ecere/status/folderOpen.png "ecere/status"
 
 # SYMBOL RULES
 
 $(OBJ)extract.sym: extract.ec
-       $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c extract.ec -o $(OBJ)extract.sym
+       $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c extract.ec -o $(OBJ)extract.sym
 
 # C OBJECT RULES
 
 $(OBJ)extract.c: extract.ec $(OBJ)extract.sym | $(SYMBOLS)
-       $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c extract.ec -o $(OBJ)extract.c -symbols $(OBJ)
-
-# IMPLICIT OBJECT RULE
-
-$(OBJ)%$(O) : $(OBJ)%.c
-       $(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@
+       $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c extract.ec -o $(OBJ)extract.c -symbols $(OBJ)
 
 # OBJECT RULES
 
+$(OBJ)extract.o: $(OBJ)extract.c
+       $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)extract.c -o $(OBJ)extract.o
+
 $(OBJ)$(MODULE).main$(O): $(OBJ)$(MODULE).main.c
-       $(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.c -o $(OBJ)$(MODULE).main$(O)
+       $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.c -o $(OBJ)$(MODULE).main$(O)
+
+cleantarget: objdir
+       $(call rmq,$(OBJ)$(MODULE).main.o $(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S))
+       $(call rmq,$(OBJ)symbols.lst)
+       $(call rmq,$(OBJ)objects.lst)
+       $(call rmq,$(TARGET))
+ifdef SHARED_LIBRARY_TARGET
+ifdef LINUX_TARGET
+ifdef LINUX_HOST
+       $(call rmq,$(OBJ)$(LP)$(MODULE)$(SO)$(basename $(VER)))
+       $(call rmq,$(OBJ)$(LP)$(MODULE)$(SO))
+endif
+endif
+endif
 
-clean: objdir
-       $(call rmq,$(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S) $(TARGET))
-       $(call rmq,$(OBJECTS))
+clean: cleantarget
+       $(call rmq,$(_OBJECTS))
+       $(call rmq,$(ECOBJECTS))
        $(call rmq,$(COBJECTS))
+       $(call rmq,$(BOWLS))
        $(call rmq,$(IMPORTS))
        $(call rmq,$(SYMBOLS))
 
-realclean:
+realclean: cleantarget
        $(call rmrq,$(OBJ))
 
-distclean:
+distclean: cleantarget
        $(call rmrq,obj/)