summaryrefslogtreecommitdiff
path: root/cd/src/tecmake_compact.mak
diff options
context:
space:
mode:
Diffstat (limited to 'cd/src/tecmake_compact.mak')
-rwxr-xr-xcd/src/tecmake_compact.mak262
1 files changed, 125 insertions, 137 deletions
diff --git a/cd/src/tecmake_compact.mak b/cd/src/tecmake_compact.mak
index 08e642e..61c4706 100755
--- a/cd/src/tecmake_compact.mak
+++ b/cd/src/tecmake_compact.mak
@@ -1,12 +1,15 @@
#-------------------------------------------------------------------------#
#- Tecmake (Compact Version) -#
#- Generic Makefile to build applications and libraries at TeCGraf -#
-#- The user makefile usually has the name "config.mak". -#
+#- The user makefile usually has the name "config.mak". -#
#-------------------------------------------------------------------------#
+#---------------------------------#
# Tecmake Version
-VERSION = 3.19
+VERSION = 3.21
+
+#---------------------------------#
# First target
.PHONY: build
build: tecmake
@@ -162,6 +165,9 @@ STDLFLAGS := r
DEBUGFLAGS := -g
STDLDFLAGS := -shared
DLIBEXT := so
+DLIBPRE := lib
+APPEXT :=
+
ifneq ($(findstring Linux, $(TEC_UNAME)), )
GTK_DEFAULT :=
@@ -176,6 +182,7 @@ ifneq ($(findstring Linux24, $(TEC_UNAME)), )
GTK_DEFAULT :=
endif
+
#---------------------------------#
# Build Tools
@@ -186,15 +193,6 @@ RANLIB := $(TEC_TOOLCHAIN)ranlib
AR := $(TEC_TOOLCHAIN)ar
DEBUGGER := $(TEC_TOOLCHAIN)gdb
RCC := $(TEC_TOOLCHAIN)windres
-LD := $(TEC_TOOLCHAIN)gcc
-
-ifeq ($(TEC_UNAME), gcc2)
- ifdef USE_GCC_2
- CC := $(CC)-2
- CPPC := $(CPPC)-2
- FF := $(FF)-2
- endif
-endif
#---------------------------------#
@@ -254,9 +252,7 @@ else
STDDEFS += -DNDEBUG
ifdef OPT
STDFLAGS += $(OPTFLAGS)
- ifeq ($(findstring gcc, $(TEC_UNAME)), )
- STRIP ?= Yes
- endif
+ STRIP ?= Yes
endif
endif
@@ -279,6 +275,7 @@ ifdef USE_CC
CC := cc
CPPC := CC
STDFLAGS =
+ UNAMES := $(UNAMES_CC)
ifdef USE_CC_DIR
TEC_UNAME := $(TEC_UNAME)cc
endif
@@ -290,14 +287,12 @@ ifdef BUILD_64
endif
endif
-ifneq ($(findstring gcc, $(TEC_UNAME)), )
- ifeq ($(MAKETYPE), APP)
- TEC_UNAME_DIR ?= $(TEC_SYSNAME)
- endif
-endif
-
TEC_UNAME_DIR ?= $(TEC_UNAME)
+TEC_UNAME_LIB_DIR ?= $(TEC_UNAME)
ifdef DBG
+ ifdef DBG_LIB_DIR
+ TEC_UNAME_LIB_DIR := $(TEC_UNAME_DIR)d
+ endif
ifdef DBG_DIR
TEC_UNAME_DIR := $(TEC_UNAME_DIR)d
endif
@@ -310,8 +305,10 @@ TARGETDIR := $(TARGETROOT)/$(TEC_UNAME_DIR)
ifndef LINKER
ifneq "$(findstring .cpp, $(SRC))" ""
LINKER := $(CPPC)
+ LD := $(CPPC)
else
LINKER := $(CC)
+ LD := $(CC)
endif
endif
@@ -357,17 +354,6 @@ MOTIFGL_LIB := GLw #include <GL/GLwMDrawA.h>
#GLUT_INC :=
-ifneq ($(findstring cygw, $(TEC_UNAME)), )
- NO_DYNAMIC ?= Yes
- ifdef BUILD_64
- X11_LIB := /usr/X11R6/lib64
- else
- X11_LIB := /usr/X11R6/lib
- endif
- X11_INC := /usr/X11R6/include
- MOTIFGL_LIB :=
-endif
-
ifneq ($(findstring Linux, $(TEC_UNAME)), )
ifdef BUILD_64
ifeq ($(TEC_SYSARCH), ia64)
@@ -455,7 +441,7 @@ ifneq ($(findstring Darwin, $(TEC_UNAME)), )
MOTIF_INC := /usr/OpenMotif/include
MOTIF_LIB := /usr/OpenMotif/lib
ifdef BUILD_DYLIB
- STDLDFLAGS := -dynamiclib -install_name lib$(TARGETNAME).dylib
+ STDLDFLAGS := -dynamiclib -Wl -headerpad_max_install_names -undefined dynamic_lookup -install_name lib$(TARGETNAME).dylib
DLIBEXT := dylib
else
STDLDFLAGS := -bundle -undefined dynamic_lookup
@@ -468,12 +454,11 @@ ifneq ($(findstring FreeBSD, $(TEC_UNAME)), )
endif
-################################
+#---------------------------------#
# Allows an extra configuration file.
ifdef EXTRA_CONFIG
include $(EXTRA_CONFIG)
endif
-################################
#---------------------------------#
@@ -485,6 +470,7 @@ CD ?= $(TECTOOLS_HOME)/cd
IM ?= $(TECTOOLS_HOME)/im
LUA ?= $(TECTOOLS_HOME)/lua
LUA51 ?= $(TECTOOLS_HOME)/lua5.1
+LUA52 ?= $(TECTOOLS_HOME)/lua52
#---------------------------------#
@@ -492,7 +478,7 @@ LUA51 ?= $(TECTOOLS_HOME)/lua5.1
# Library order:
# user + iupcd + cd + iup + motif + X
-# Library path order is the oposite
+# Library path order is reversed
USE_MOTIF = Yes
@@ -531,12 +517,18 @@ ifdef USE_LUA51
NO_LUALIB := Yes
endif
+ifdef USE_LUA52
+ LUASUFX := 52
+ LIBLUASUFX := 52
+ override USE_LUA = Yes
+ LUA := $(LUA52)
+ NO_LUALIB := Yes
+endif
+
ifdef USE_IUP3
override USE_IUP = Yes
-endif
-
-ifdef USE_IUP3BETA
- IUP := $(IUP)3
+# Inside Tecgraf only
+# IUP := $(IUP)3
endif
ifdef USE_IUPBETA
@@ -555,19 +547,23 @@ ifdef USE_GLUT
override USE_OPENGL = Yes
endif
+ifdef USE_GDK
+ override USE_GTK = Yes
+endif
+
ifdef USE_IUPCONTROLS
override USE_CD = Yes
override USE_IUP = Yes
ifdef USE_IUPLUA
ifdef USE_STATIC
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupluacontrols$(LIBLUASUFX).a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupluacontrols$(LIBLUASUFX).a
else
LIBS += iupluacontrols$(LIBLUASUFX)
endif
override USE_CDLUA = Yes
endif
ifdef USE_STATIC
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupcontrols.a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupcontrols.a
else
LIBS += iupcontrols
endif
@@ -576,7 +572,7 @@ endif
ifdef USE_IMLUA
override USE_IM = Yes
ifdef USE_STATIC
- SLIB += $(IM)/lib/$(TEC_UNAME)/libimlua$(LIBLUASUFX).a
+ SLIB += $(IM)/lib/$(TEC_UNAME_LIB_DIR)/libimlua$(LIBLUASUFX).a
else
LIBS += imlua$(LIBLUASUFX)
endif
@@ -587,10 +583,10 @@ ifdef USE_CDLUA
ifdef USE_STATIC
ifdef USE_IUP
ifdef USE_OLDNAMES
- SLIB += $(CD)/lib/$(TEC_UNAME)/libcdluaiup$(LIBLUASUFX).a
+ SLIB += $(CD)/lib/$(TEC_UNAME_LIB_DIR)/libcdluaiup$(LIBLUASUFX).a
endif
endif
- SLIB += $(CD)/lib/$(TEC_UNAME)/libcdlua$(LIBLUASUFX).a
+ SLIB += $(CD)/lib/$(TEC_UNAME_LIB_DIR)/libcdlua$(LIBLUASUFX).a
else
ifdef USE_IUP
ifdef USE_OLDNAMES
@@ -606,13 +602,13 @@ ifdef USE_IUPLUA
ifdef USE_STATIC
ifdef USE_CD
ifndef USE_OLDNAMES
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupluacd$(LIBLUASUFX).a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupluacd$(LIBLUASUFX).a
endif
endif
ifdef USE_OPENGL
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupluagl$(LIBLUASUFX).a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupluagl$(LIBLUASUFX).a
endif
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiuplua$(LIBLUASUFX).a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiuplua$(LIBLUASUFX).a
else
ifdef USE_CD
ifndef USE_OLDNAMES
@@ -627,7 +623,7 @@ ifdef USE_IUPLUA
endif
ifdef USE_LUA
- LUA_LIB ?= $(LUA)/lib/$(TEC_UNAME)
+ LUA_LIB ?= $(LUA)/lib/$(TEC_UNAME_LIB_DIR)
ifdef USE_STATIC
ifndef NO_LUALIB
SLIB += $(LUA_LIB)/liblualib$(LUASUFX).a
@@ -638,8 +634,13 @@ ifdef USE_LUA
LIBS += lualib$(LUASUFX)
endif
ifndef NO_LUALINK
- LIBS += lua$(LUASUFX)
- LDIR += $(LUA_LIB)
+ LIBS += lua$(LUASUFX)
+ LDIR += $(LUA_LIB)
+ else
+ ifneq ($(findstring cygw, $(TEC_UNAME)), )
+ LIBS += lua$(LUASUFX)
+ LDIR += $(LUA_LIB)
+ endif
endif
endif
@@ -674,13 +675,13 @@ ifdef USE_IUP
ifdef USE_STATIC
ifdef USE_CD
ifndef USE_OLDNAMES
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupcd.a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupcd.a
endif
endif
ifdef USE_OPENGL
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiupgl.a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiupgl.a
endif
- SLIB += $(IUP)/lib/$(TEC_UNAME)/libiup$(IUPSUFX).a
+ SLIB += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)/libiup$(IUPSUFX).a
else
ifdef USE_CD
ifndef USE_OLDNAMES
@@ -691,7 +692,7 @@ ifdef USE_IUP
LIBS += iupgl
endif
LIBS += iup$(IUPSUFX)
- LDIR += $(IUP)/lib/$(TEC_UNAME)
+ LDIR += $(IUP)/lib/$(TEC_UNAME_LIB_DIR)
endif
INCLUDES += $(IUP)/include
endif
@@ -730,8 +731,12 @@ ifdef USE_CD
LIBS += cdcontextplus
endif
endif
- LIBS += cd
- LDIR += $(CD)/lib/$(TEC_UNAME)
+ ifdef USE_GDK
+ LIBS += cdgdk
+ else
+ LIBS += cd
+ endif
+ LDIR += $(CD)/lib/$(TEC_UNAME_LIB_DIR)
ifdef USE_XRENDER
LIBS += Xrender Xft
else
@@ -748,17 +753,14 @@ endif
ifdef USE_IM
ifdef USE_STATIC
- SLIB += $(IM)/lib/$(TEC_UNAME)/libim.a
+ SLIB += $(IM)/lib/$(TEC_UNAME_LIB_DIR)/libim.a
else
LIBS += im
- LDIR += $(IM)/lib/$(TEC_UNAME)
+ LDIR += $(IM)/lib/$(TEC_UNAME_LIB_DIR)
endif
INCLUDES += $(IM)/include
endif
-# All except gcc in Windows (Cygwin)
-ifeq ($(findstring gcc, $(TEC_UNAME)), )
-
ifdef USE_GLUT
LIBS += glut
LDIR += $(GLUT_LIB)
@@ -768,7 +770,9 @@ endif
ifdef USE_OPENGL
override USE_X11 = Yes
ifdef USE_MOTIF
- LIBS += $(MOTIFGL_LIB)
+ ifndef USE_IUP3
+ LIBS += $(MOTIFGL_LIB)
+ endif
endif
LIBS += $(OPENGL_LIBS)
LDIR += $(OPENGL_LIB)
@@ -789,35 +793,41 @@ ifdef USE_MOTIF
endif
ifdef USE_GTK
-# ifneq ($(findstring Darwin, $(TEC_UNAME)), )
-# STDINCS += /Library/Frameworks/Gtk.framework/Headers
-# STDINCS += /Library/Frameworks/GLib.framework/Headers
-# STDINCS += /Library/Frameworks/Cairo.framework/Headers
-# LFLAGS += -framework Gtk
-# else
- ifneq ($(findstring Darwin, $(TEC_UNAME)), )
- GTK_BASE := /sw
- LDIR += /sw/lib
- LIBS += freetype
- else
- GTK_BASE := /usr
- endif
+ ifneq ($(findstring Darwin, $(TEC_UNAME)), )
+# Option 1 - old GTK port
+# GTK_BASE := /sw
+# LDIR += /sw/lib
+# Option 2 - old Framework
+# STDINCS += /Library/Frameworks/Gtk.framework/Headers
+# STDINCS += /Library/Frameworks/GLib.framework/Headers
+# STDINCS += /Library/Frameworks/Cairo.framework/Headers
+# LFLAGS += -framework Gtk
+# Option 3 - new Framework
+ GTK_BASE := /Users/cpts/gtk/inst
+ LDIR += $(GTK_BASE)/lib
+ LFLAGS += -framework Carbon
+ LIBS += gtk-quartz-2.0 gdk-quartz-2.0 pangoft2-1.0
+
+ LIBS += freetype
+ else
+ GTK_BASE := /usr
override USE_X11 = Yes
- LIBS += gtk-x11-2.0 gdk-x11-2.0 gdk_pixbuf-2.0 pango-1.0 pangox-1.0 gobject-2.0 gmodule-2.0 glib-2.0
- STDINCS += $(GTK_BASE)/include/atk-1.0 $(GTK_BASE)/include/gtk-2.0 $(GTK_BASE)/include/cairo $(GTK_BASE)/include/pango-1.0 $(GTK_BASE)/include/glib-2.0
- ifeq ($(TEC_SYSARCH), x64)
- STDINCS += $(GTK_BASE)/lib64/glib-2.0/include $(GTK_BASE)/lib64/gtk-2.0/include
- else
- ifeq ($(TEC_SYSARCH), ia64)
- STDINCS += $(GTK_BASE)/lib64/glib-2.0/include $(GTK_BASE)/lib64/gtk-2.0/include
- else
- STDINCS += $(GTK_BASE)/lib/glib-2.0/include $(GTK_BASE)/lib/gtk-2.0/include
- endif
- endif
- ifneq ($(findstring FreeBSD, $(TEC_UNAME)), )
- STDINCS += /lib/X11R6/include/gtk-2.0
- endif
-# endif
+ LIBS += gtk-x11-2.0 gdk-x11-2.0 pangox-1.0
+ endif
+ LIBS += gdk_pixbuf-2.0 pango-1.0 gobject-2.0 gmodule-2.0 glib-2.0
+ STDINCS += $(GTK_BASE)/include/atk-1.0 $(GTK_BASE)/include/gtk-2.0 $(GTK_BASE)/include/cairo $(GTK_BASE)/include/pango-1.0 $(GTK_BASE)/include/glib-2.0
+ ifeq ($(TEC_SYSARCH), x64)
+ STDINCS += $(GTK_BASE)/lib64/glib-2.0/include $(GTK_BASE)/lib64/gtk-2.0/include
+ else
+ ifeq ($(TEC_SYSARCH), ia64)
+ STDINCS += $(GTK_BASE)/lib64/glib-2.0/include $(GTK_BASE)/lib64/gtk-2.0/include
+ else
+ STDINCS += $(GTK_BASE)/lib/glib-2.0/include $(GTK_BASE)/lib/gtk-2.0/include
+ endif
+ endif
+ ifneq ($(findstring FreeBSD, $(TEC_UNAME)), )
+ STDINCS += /lib/X11R6/include/gtk-2.0
+ endif
endif
ifdef USE_QT
@@ -836,43 +846,14 @@ endif
LIBS += m
-else
- # gcc in Windows
- NO_DYNAMIC ?= Yes
- STDDEFS += -DWIN32
-
- ifdef USE_NOCYGWIN
- STDFLAGS += -mno-cygwin
- endif
-
- ifdef USE_GLUT
- LIBS += glut32
- endif
-
- ifdef USE_OPENGL
- LIBS += opengl32 glu32 glaux
- endif
-
- LIBS += gdi32 winspool comdlg32 comctl32 ole32
+ifneq ($(findstring cygw, $(TEC_UNAME)), )
+ DLIBEXT := dll
+ APPEXT := .exe
+# Use the cyg prefix to indicate that it is a Cygwin Posix DLL
+ DLIBPRE := cyg
- ifdef USE_GTK
- LIBS += gtk-win32-2.0 gdk-win32-2.0 gdk_pixbuf-2.0 pango-1.0 pangowin32-1.0 gobject-2.0 gmodule-2.0 glib-2.0
- #LDIR += $(GTK)/lib
- GTK_INC = /usr
- STDINCS += $(GTK_INC)/include/atk-1.0 $(GTK_INC)/include/gtk-2.0 $(GTK_INC)/include/cairo $(GTK_INC)/include/pango-1.0 $(GTK_INC)/include/glib-2.0 $(GTK_INC)/lib/glib-2.0/include $(GTK_INC)/lib/gtk-2.0/include
- endif
-
- APPTYPE ?= windows
-
- ifeq ($(APPTYPE), windows)
- LFLAGS += -mwindows
-
- ifdef USE_NOCYGWIN
- LFLAGS += -mno-cygwin
- endif
- endif
-endif
-
+ STDLDFLAGS += -Wl,--out-implib=$(TARGETDIR)/lib$(TARGETNAME).dll.a
+endif
#---------------------------------#
# Building compilation flags that are sets
@@ -901,14 +882,18 @@ CXXFLAGS = $(CPPFLAGS) $(STDFLAGS) $(INCLUDES) $(STDINCS) $(EXTRAINCS) $(DEFINES
# Sources with relative path
SOURCES := $(addprefix $(SRCDIR)/, $(SRC))
+TARGETAPPNAME := $(TARGETNAME)$(APPEXT)
+TARGETSLIBNAME := lib$(TARGETNAME).a
+TARGETDLIBNAME := $(DLIBPRE)$(TARGETNAME).$(DLIBEXT)
+
# Target for applications or libraries
ifeq ($(MAKETYPE), APP)
- TARGET := $(TARGETDIR)/$(TARGETNAME)
+ TARGET := $(TARGETDIR)/$(TARGETAPPNAME)
else
ifeq ($(NO_DYNAMIC), Yes)
- TARGET := $(TARGETDIR)/lib$(TARGETNAME).a
+ TARGET := $(TARGETDIR)/$(TARGETSLIBNAME)
else
- TARGET := $(TARGETDIR)/lib$(TARGETNAME).a $(TARGETDIR)/lib$(TARGETNAME).$(DLIBEXT)
+ TARGET := $(TARGETDIR)/$(TARGETSLIBNAME) $(TARGETDIR)/$(TARGETDLIBNAME)
endif
endif
@@ -963,9 +948,9 @@ print-start:
# Dynamic Library Build
.PHONY: dynamic-lib
-dynamic-lib: $(TARGETDIR)/lib$(TARGETNAME).$(DLIBEXT)
+dynamic-lib: $(TARGETDIR)/$(TARGETDLIBNAME)
-$(TARGETDIR)/lib$(TARGETNAME).$(DLIBEXT) : $(LOHS) $(OBJS) $(EXTRADEPS)
+$(TARGETDIR)/$(TARGETDLIBNAME) : $(LOHS) $(OBJS) $(EXTRADEPS)
$(LD) $(STDLDFLAGS) -o $@ $(OBJS) $(SLIB) $(LFLAGS)
@echo 'Tecmake - Dynamic Library ($@) Done.'; echo ''
@@ -974,9 +959,9 @@ $(TARGETDIR)/lib$(TARGETNAME).$(DLIBEXT) : $(LOHS) $(OBJS) $(EXTRADEPS)
# Static Library Build
.PHONY: static-lib
-static-lib: $(TARGETDIR)/lib$(TARGETNAME).a
+static-lib: $(TARGETDIR)/$(TARGETSLIBNAME)
-$(TARGETDIR)/lib$(TARGETNAME).a : $(LOHS) $(OBJS) $(EXTRADEPS)
+$(TARGETDIR)/$(TARGETSLIBNAME) : $(LOHS) $(OBJS) $(EXTRADEPS)
$(AR) $(STDLFLAGS) $@ $(OBJS) $(SLIB) $(LCFLAGS)
-$(RANLIB) $@
@echo 'Tecmake - Static Library ($@) Done.'; echo ''
@@ -986,9 +971,9 @@ $(TARGETDIR)/lib$(TARGETNAME).a : $(LOHS) $(OBJS) $(EXTRADEPS)
# Application Build
.PHONY: application
-application: $(TARGETDIR)/$(TARGETNAME)
+application: $(TARGETDIR)/$(TARGETAPPNAME)
-$(TARGETDIR)/$(TARGETNAME) : $(LOHS) $(OBJS) $(EXTRADEPS)
+$(TARGETDIR)/$(TARGETAPPNAME) : $(LOHS) $(OBJS) $(EXTRADEPS)
$(LINKER) -o $@ $(OBJS) $(SLIB) $(LFLAGS)
@if [ ! -z "$(STRIP)" ]; then \
echo "Striping debug information" ;\
@@ -1149,11 +1134,11 @@ clean-target:
.PHONY: clean
clean: clean-target clean-obj
-# make rebuild
+# make strip
# Remove symbols from executables
.PHONY: strip
strip:
- test -r $(TARGETDIR)/$(TARGETNAME) && strip $(TARGETDIR)/$(TARGETNAME)
+ test -r $(TARGETDIR)/$(TARGETAPPNAME) && strip $(TARGETDIR)/$(TARGETAPPNAME)
# make rebuild
# Rebuild target and object files
@@ -1165,6 +1150,9 @@ rebuild: clean-extra clean-lohs clean-obj clean-target tecmake
.PHONY: relink
relink: clean-target tecmake
+
+#---------------------------------#
+
.PHONY: version
version:
@echo "Tecmake Compact Version $(VERSION)"