Skip to content

Commit

Permalink
a better version of makefiles (stil WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Sep 8, 2016
1 parent a264739 commit 4dcfa67
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 37 deletions.
6 changes: 5 additions & 1 deletion build.macos32x86/common/Makefile.app
Expand Up @@ -69,6 +69,10 @@ else
$(error USEPLUGINASDYLIB has to be TRUE or FALSE)
endif

ifneq ($(THIRDPARTYLIBS),)
THIRDPARTYPREREQS:=$(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR)
endif

OSXICONS:=$(OSXDIR)/$(VM).icns $(wildcard $(OSXDIR)/$(SYSTEM)*.icns)
VMICONS:=$(addprefix $(APP)/Contents/Resources/,$(notdir $(OSXICONS)))
VMMENUNIB:=$(APP)/Contents/Resources/English.lproj/MainMenu.nib
Expand All @@ -93,7 +97,7 @@ SED_COMMAND_INFO_PLIST:=\
s!$$(VM_MINOR)!$(shell ./getversion VM_MINOR)!g;\
#

$(APP): cleanbundles $(VMEXE) $(VMBUNDLES) $(VMPLUGINDYLIBS) \
$(APP): cleanbundles $(THIRDPARTYPREREQS) $(VMEXE) $(VMBUNDLES) $(VMPLUGINDYLIBS) \
$(VMPLIST) $(VMLOCALIZATION) $(VMMENUNIB) $(VMICONS) \
$(SOURCES) $(THIRDPARTYLIBS) $(APPPOST) signapp touchapp

Expand Down
17 changes: 9 additions & 8 deletions build.macos32x86/common/Makefile.extra
Expand Up @@ -6,22 +6,23 @@
# REQUIRES:
# USEPLUGINASDYLIB Used to define where to place built libraries (default is FALSE (or absent)).
#
THIRDPARTYDIR:=$(BLDDIR)/third-party
THIRDPARTYOUTDIR:=$(abspath $(THIRDPARTYDIR)/out)
THIRDPARTYLIBDIR:=$(THIRDPARTYOUTDIR)/lib
THIRDPARTYINCLUDEDIR:=$(THIRDPARTYOUTDIR)/include
THIRDPARTYDIR?=$(BLDDIR)/third-party
THIRDPARTYOUTDIR?=$(abspath $(THIRDPARTYDIR)/out)
THIRDPARTYLIBDIR?=$(THIRDPARTYOUTDIR)/lib
THIRDPARTYINCLUDEDIR?=$(THIRDPARTYOUTDIR)/include

ifeq ($(USEPLUGINASDYLIB),TRUE)
THIRDPARTYINSTALLDIR:=$(APP)/Contents/MacOS/Plugins
else
THIRDPARTYINSTALLDIR:=$(APP)/Contents/Resources
endif

$(THIRDPARTYDIR):
mkdir -p $(THIRDPARTYDIR)
$(THIRDPARTYDIR):
if [ ! -d $(THIRDPARTYDIR) ]; then mkdir -p $(THIRDPARTYDIR); fi

$(THIRDPARTYOUTDIR): $(THIRDPARTYDIR)
mkdir -p $(THIRDPARTYOUTDIR)
if [ ! -d $(THIRDPARTYOUTDIR) ]; then mkdir -p $(THIRDPARTYOUTDIR); fi

$(THIRDPARTYINSTALLDIR):
mkdir -p $(THIRDPARTYINSTALLDIR)
if [ ! -d $(THIRDPARTYINSTALLDIR) ]; then mkdir -p $(THIRDPARTYINSTALLDIR); fi

2 changes: 1 addition & 1 deletion build.macos32x86/common/Makefile.vm
Expand Up @@ -255,7 +255,7 @@ $(OBJDIR)/%.bundle: FORCE

# External plugin. Made in the "Pharo way": as a simple dylib to be included in
# Plugins directory
$(OBJDIR)/%.dylib: FORCE
$(OBJDIR)/%.dylib: FORCE
@-mkdir -p $(BLDDIR)/$(*F)
test $@ -ot $(call plugin-makefile,$(*F)) && rm -rf $(BUILD)/vm/$(*F).* || true
rm -f $(BUILD)/vm/$(*F).ignore
Expand Down
6 changes: 4 additions & 2 deletions build.macos32x86/pharo.cog.spur/Makefile
Expand Up @@ -3,15 +3,17 @@
# Do make init to allow make -n to function.
#

VMSRCDIR:=../../.generatedsrc/vm
PLUGINSRCDIR:=../../.generatedsrc/plugins
VMSRCDIR:=../../pharosrc/vm
PLUGINSRCDIR:=../../pharosrc/plugins
VM:=Pharo
COGDEFS:=-DPharoVM=1
APPNAME:=Pharo
APPNAMEDEF:=$(APPNAME)
USEPLUGINASDYLIB:=TRUE
THIRDPARTYLIBS:=pkgconfig freetype2 libssh2 libgit2 libsdl2 pixman libpng cairo

#CFLAGS=$(CFLAGS) -DNSZombieEnabled=YES

# Now include the Makefile proper, which is common to all Mac OS builds.
#
include ../common/Makefile.app
Expand Down
3 changes: 2 additions & 1 deletion build.macos32x86/pharo.cog.spur/plugins.ext
Expand Up @@ -14,8 +14,9 @@ SqueakSSL \
SurfacePlugin \
UUIDPlugin \
SerialPlugin \
SDL2DisplayPlugin \
ObjectiveCPlugin \
SDL2DisplayPlugin \
EventsHandlerPlugin \
# could work, but I don't know if relevant:
# TestOSAPlugin \
# not working (because of Cocoa vs Carbon):
Expand Down
10 changes: 5 additions & 5 deletions build.macos32x86/third-party/cairo/Makefile.lib
Expand Up @@ -13,16 +13,16 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(CAIROLIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(CAIRODIR)/configure: $(THIRDPARTYDIR)
$(CAIRODIR)/configure:
curl -L $(CAIROURL) | tar x -C $(THIRDPARTYDIR)
touch $(CAIRODIR)/configure

$(CAIROLIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(CAIRODIR)/configure pkgconfig
$(CAIROLIB): pkgconfig libpng freetype2 pixman $(CAIRODIR)/configure
cd $(CAIRODIR) \
&& ./configure \
--prefix='$(THIRDPARTYOUTDIR)' \
PKG_CONFIG='$(PKG_CONFIG)' \
PKG_CONFIG_PATH='$(PKG_CONFIG_PATH)' \
--prefix="$(THIRDPARTYOUTDIR)" \
PKG_CONFIG="$(PKG_CONFIG)" \
PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
CFLAGS='-arch i386' \
LDFLAGS='-arch i386' \
--disable-silent-rules \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/freetype2/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR) $(THIRDPARTYINCLUDEDIR)/freetype2
EXTRALIBS:=$(EXTRALIBS) $(FREETYPE2LIB)
PLUGINREQS:=$(PLUGINREQS) $(THIRDPARTYLIBS)

$(FREETYPE2DIR)/configure: $(THIRDPARTYDIR)
$(FREETYPE2DIR)/configure:
curl $(FREETYPE2URL) | tar x -C $(THIRDPARTYDIR)
touch $(FREETYPE2DIR)/configure

$(FREETYPE2LIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(FREETYPE2DIR)/configure
$(FREETYPE2LIB): pkgconfig libpng $(FREETYPE2DIR)/configure
cd $(FREETYPE2DIR) \
&& ./configure \
--prefix='$(THIRDPARTYOUTDIR)' \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/libgit2/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(LIBGIT2LIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(LIBGIT2DIR)/CMakeLists.txt: $(THIRDPARTYDIR)
$(LIBGIT2DIR)/CMakeLists.txt:
curl -L $(LIBGIT2URL) | tar x -C $(THIRDPARTYDIR)
touch $(LIBGIT2DIR)/CMakeLists.txt

$(LIBGIT2LIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(LIBGIT2DIR)/CMakeLists.txt
$(LIBGIT2LIB): $(LIBGIT2DIR)/CMakeLists.txt
cd $(LIBGIT2DIR) \
&& cmake \
-DCMAKE_INSTALL_PREFIX=$(THIRDPARTYOUTDIR) \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/libpng/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(LIBPNGLIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(LIBPNGDIR)/configure: $(THIRDPARTYDIR)
$(LIBPNGDIR)/configure:
curl -L $(LIBPNGURL) | tar x -C $(THIRDPARTYDIR)
touch $(LIBPNGDIR)/configure

$(LIBPNGLIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(LIBPNGDIR)/configure
$(LIBPNGLIB): $(LIBPNGDIR)/configure
cd $(LIBPNGDIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' CFLAGS='-arch i386' LDFLAGS='-arch i386' \
&& make \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/libsdl2/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) -undefined dynamic_lookup $(LIBSDL2LIB)
PLUGINREQS:=$(PLUGINREQS) $(THIRDPARTYLIBS)

$(LIBSDL2DIR)/configure: $(THIRDPARTYDIR)
$(LIBSDL2DIR)/configure:
curl $(LIBSDL2URL) | tar x -C $(THIRDPARTYDIR)
touch $(LIBSDL2DIR)/configure

$(LIBSDL2LIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(LIBSDL2DIR)/configure
$(LIBSDL2LIB): $(LIBSDL2DIR)/configure
cd $(LIBSDL2DIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' CFLAGS='-arch i386' LDFLAGS='-arch i386' \
&& make \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/libssh2/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(LIBSSH2LIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(LIBSSH2DIR)/configure: $(THIRDPARTYDIR)
$(LIBSSH2DIR)/configure:
curl -L $(LIBSSH2URL) | tar x -C $(THIRDPARTYDIR)
touch $(LIBSSH2DIR)/configure

$(LIBSSH2LIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(LIBSSH2DIR)/configure
$(LIBSSH2LIB): $(LIBSSH2DIR)/configure
cd $(LIBSSH2DIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' CFLAGS='-arch i386' LDFLAGS='-arch i386' \
&& make \
Expand Down
4 changes: 2 additions & 2 deletions build.macos32x86/third-party/pixman/Makefile.lib
Expand Up @@ -13,11 +13,11 @@ INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(PIXMANLIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(PIXMANDIR)/configure: $(THIRDPARTYDIR)
$(PIXMANDIR)/configure:
curl -L $(PIXMANURL) | tar x -C $(THIRDPARTYDIR)
touch $(PIXMANDIR)/configure

$(PIXMANLIB): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(PIXMANDIR)/configure
$(PIXMANLIB): $(PIXMANDIR)/configure
cd $(PIXMANDIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' CFLAGS='-arch i386' LDFLAGS='-arch i386' \
&& make \
Expand Down
14 changes: 7 additions & 7 deletions build.macos32x86/third-party/pkgconfig/Makefile.lib
Expand Up @@ -6,26 +6,26 @@ $(info LIBRARY: pkgconfig)
PKGCONFIGURL:=http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
PKGCONFIGDIR:=$(THIRDPARTYDIR)/pkg-config-0.23
PKGCONFIGBIN:=$(THIRDPARTYOUTDIR)/bin/pkg-config
PKGCONFIGLIB:=$(THIRDPARTYLIBDIR)/pkgconfig
PKGCONFIGLIB:=$(THIRDPARTYOUTDIR)/lib/pkgconfig

# ensure third-party library is built and recognised by plugins
INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(PKGCONFIGLIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

# export this values if pkg_config is included
PKG_CONFIG:=$(PKGCONFIGBIN)
PKG_CONFIG_PATH:=$(PKGCONFIGLIB)

$(info $$THIRDPARTYLIBS: $THIRDPARTYLIBS)

$(PKGCONFIGDIR)/configure: $(THIRwDPARTYDIR)
$(PKGCONFIGDIR)/configure:
curl -L $(PKGCONFIGURL) | tar x -C $(THIRDPARTYDIR)
touch $(PKGCONFIGDIR)/configure

$(PKGCONFIGBIN): $(THIRDPARTYINSTALLDIR) $(THIRDPARTYOUTDIR) $(PKGCONFIGDIR)/configure
$(PKGCONFIGBIN): $(PKGCONFIGDIR)/configure
cd $(PKGCONFIGDIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' CFLAGS=' -std=gnu89 -arch i386' LDFLAGS='-arch i386' \
&& ./configure \
--prefix='$(THIRDPARTYOUTDIR)' \
CFLAGS='-std=gnu89 -arch i386' \
LDFLAGS='-arch i386' \
&& make \
&& make install

Expand Down

0 comments on commit 4dcfa67

Please sign in to comment.