ifeq ($(SYSTEM),) SYSTEM=$(shell uname) endif TRUESYSTEM=$(shell uname) MACHINE=$(shell uname -m) DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) GL_GLUE=gl-glue.s CC = gcc CXX = g++ LD = g++ AS = as AR = ar rcs USR=/usr LIBXM = -lXm ifeq ($(SYSTEM),Darwin) ARCH_FLAGS=-arch i386 SHARED_FLAGS=-dynamiclib SHARED_EXT=dylib CPPFLAGS = -dynamic LD = g++ -arch i386 STRIP = strip -x FINK= ifeq ($(TRUESYSTEM),Linux) CC = i686-apple-darwin9-gcc CXX = i686-apple-darwin9-g++ LD = i686-apple-darwin9-g++ -arch i386 -mmacosx-version-min=10.5 STRIP = i686-apple-darwin9-strip -x AS = i686-apple-darwin9-as -arch i386 LIPO = i686-apple-darwin9-lipo AR = i686-apple-darwin9-ar rcs ARCH_FLAGS = LDFLAGS_MESA = -all_load ../Mesa-7.4.4-darwin9/lib/libGLU.a ../Mesa-7.4.4-darwin LUAJIT = ../LuaJIT-darwin9/src/libluajit.a USR=/usr/i686-apple-darwin9 FINK=$(USR) LIBXM = $(FINK) endif LIBXM = $(FINK)/sw/lib/libXm.a -lXp else ARCH_FLAGS=-march=i686 -m32 SHARED_FLAGS=-shared SHARED_EXT=so LD = g++ -m32 STRIP = strip --strip-unneeded endif INCLUDES = \ -I../Baltisot/include \ -I../LuaJIT/src \ -I $(USR)/include/freetype2 \ -I $(FINK)/sw/include \ -I $(USR)/X11/include/freetype2 -I $(USR)/X11/include \ -I /usr/include/gtk-2.0 -I /usr/include/glib-2.0 -I /usr/lib/glib-2.0/include -I /usr/include/cairo -I /usr/include/pango-1.0 -I /usr/lib/gtk-2.0/include -I /usr/include/atk-1.0 \ -I im/include -I cd/include -I cd/src/sim -I cd/src/x11 -I iup/include -I iup/src -I iup/srccontrols \ HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H -DCD_NO_OLD_INTERFACE -DGTK_DISABLE_DEPRECATED -DIUPLUA_USELOH -DUSE_STATIC CPPFLAGS_NO_ARCH += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(HAVES) -DTEC_LITTLEENDIAN -g -DNDEBUG -DUSE_MGL_NAMESPACE CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) -L$(USR)/X11/lib -L$(FINK)/sw/lib ./lua-interface.$(SHARED_EXT) vpath %.c ../Baltisot/lib:../Baltisot/src:src:im/src:im/src/process:im/src/lua5:cd/src:cd/src/intcgm:cd/src/drv:cd/src/sim:cd/src/x11:cd/src/xrender:cd/src/lua5:iup/src:iup/src/mot:iup/src/gtk:iup/srccd:iup/srccontrols:iup/srccontrols/color:iup/srccontrols/matrix:iup/srcim:iup/srcledc:iup/srclua5:cd/src/svg vpath %.cc ../Baltisot/lib:../Baltisot/src:src:im/src:im/src/process:im/src/lua5:cd/src:cd/src/intcgm:cd/src/drv:cd/src/sim:cd/src/x11:cd/src/xrender:cd/src/lua5:iup/src:iup/src/mot:iup/src/gtk:iup/srccd:iup/srccontrols:iup/srccontrols/color:iup/srccontrols/matrix:iup/srcim:iup/srcledc:iup/srclua5:cd/src/svg vpath %.cpp ../Baltisot/lib:../Baltisot/src:src:im/src:im/src/process:im/src/lua5:cd/src:cd/src/intcgm:cd/src/drv:cd/src/sim:cd/src/x11:cd/src/xrender:cd/src/lua5:iup/src:iup/src/mot:iup/src/gtk:iup/srccd:iup/srccontrols:iup/srccontrols/color:iup/srccontrols/matrix:iup/srcim:iup/srcledc:iup/srclua5:cd/src/svg vpath %.lua ../Baltisot/lib:../Baltisot/src IM_SOURCES = \ im_converttype.cpp \ im_attrib.cpp \ im_format.cpp \ im_format_tga.cpp \ im_filebuffer.cpp \ im_bin.cpp \ im_format_all.cpp \ im_format_raw.cpp \ im_binfile.cpp \ im_format_sgi.cpp \ im_datatype.cpp \ im_format_pcx.cpp \ im_colorhsi.cpp \ im_format_bmp.cpp \ im_image.cpp \ im_rgb2map.cpp \ im_colormode.cpp \ im_format_gif.cpp \ im_lib.cpp \ im_format_pnm.cpp \ im_colorutil.cpp \ im_format_ico.cpp \ im_palette.cpp \ im_convertbitmap.cpp \ im_format_led.cpp \ im_counter.cpp \ im_str.cpp \ im_convertcolor.cpp \ im_fileraw.cpp \ im_format_krn.cpp \ im_file.cpp \ im_format_ras.cpp \ im_sysfile_unix.cpp \ im_arithmetic_bin.cpp \ im_morphology_gray.cpp \ im_quantize.cpp \ im_arithmetic_un.cpp \ im_geometric.cpp \ im_render.cpp \ im_color.cpp \ im_histogram.cpp \ im_resize.cpp \ im_convolve.cpp \ im_houghline.cpp \ im_statistics.cpp \ im_convolve_rank.cpp \ im_logic.cpp \ im_threshold.cpp \ im_effects.cpp \ im_morphology_bin.cpp \ im_tonegamut.cpp \ im_canny.cpp \ im_distance.cpp \ im_analyze.cpp \ im_kernel.cpp \ imlua.c \ imlua_aux.c \ imlua_convert.c \ imlua_file.c \ imlua_image.c \ imlua_palette.c \ imlua_util.c \ imlua_process.c \ imlua_kernel.c \ IM_LIBS = CD_SOURCES = \ cd.c \ wd.c \ wdhdcpy.c \ rgb2map.c \ cd_vectortext.c \ cd_active.c \ cd_attributes.c \ cd_bitmap.c \ cd_image.c \ cd_primitives.c \ cd_text.c \ cd_util.c \ circle.c \ ellipse.c \ intcgm1.c \ intcgm2.c \ intcgm4.c \ intcgm6.c \ list.c \ sism.c \ tparse.c \ bparse.c \ cddgn.c \ cdcgm.c \ cgm.c \ cddxf.c \ cdirgb.c \ cdmf.c \ cdps.c \ cdpicture.c \ cddebug.c \ cdfontex.c \ sim.c \ sim_other.c \ sim_primitives.c \ sim_linepolyfill.c \ cd0prn.c \ cd0emf.c \ cd0wmf.c \ cdx11.c \ cdxclp.c \ cdximg.c \ cdxnative.c \ cdxdbuf.c \ xvertex.c \ cdxrender.c \ cdxrplus.c \ cdlua5.c \ cdvoid5.c \ cdlua5ctx.c \ cdlua5_active.c \ cdlua5_canvas.c \ cdluacontextplus5.c \ cdluaim5.c \ base64.c \ cdsvg.c \ lodepng.c \ CD_LIBS = IUP_SOURCES = \ iup_array.c \ iup_callback.c \ iup_dlglist.c \ iup_attrib.c \ iup_focus.c \ iup_font.c \ iup_globalattrib.c \ iup_object.c \ iup_key.c \ iup_layout.c \ iup_ledlex.c \ iup_names.c \ iup_open.c \ iup_ledparse.c \ iup_predial.c \ iup_register.c \ iup_scanf.c \ iup_show.c \ iup_str.c \ iup_table.c \ iup_func.c \ iup_childtree.c \ iup.c \ iup_classattrib.c \ iup_dialog.c \ iup_assert.c \ iup_canvas.c \ iup_messagedlg.c \ iup_timer.c \ iup_image.c \ iup_label.c \ iup_fill.c \ iup_zbox.c \ iup_colordlg.c \ iup_fontdlg.c \ iup_filedlg.c \ iup_strmessage.c \ iup_menu.c \ iup_frame.c \ iup_user.c \ iup_button.c \ iup_radio.c \ iup_toggle.c \ iup_progressbar.c \ iup_text.c \ iup_val.c \ iup_box.c \ iup_hbox.c \ iup_vbox.c \ iup_cbox.c \ iup_class.c \ iup_classbase.c \ iup_maskmatch.c \ iup_mask.c \ iup_maskparse.c \ iup_tabs.c \ iup_spin.c \ iup_list.c \ iup_getparam.c \ iup_sbox.c \ iup_normalizer.c \ iup_tree.c \ iup_oldmask.c \ iup_split.c \ iupmot_common.c \ iupmot_color.c \ iupmot_draw.c \ iupmot_focus.c \ iupmot_font.c \ iupmot_key.c \ iupmot_loop.c \ iupmot_open.c \ iupmot_tips.c \ iupmot_globalattrib.c \ iupmot_dialog.c \ iupmot_messagedlg.c \ iupmot_timer.c \ iupmot_image.c \ iupmot_label.c \ iupmot_canvas.c \ iupmot_colordlg.c \ iupmot_fontdlg.c \ iupmot_filedlg.c \ iupmot_frame.c \ iupmot_button.c \ iupmot_toggle.c \ iupmot_progressbar.c \ iupmot_clipboard.c \ iupmot_text.c \ iupmot_val.c \ iupmot_tabs.c \ iupmot_menu.c \ iupmot_list.c \ iupmot_tree.c \ iupunix_help.c \ iupunix_info.c \ iup_cd.c \ iup_cdutil.c \ iup_gauge.c \ iup_cells.c \ iup_colorbar.c \ iup_controls.c \ iup_dial.c \ iup_colorbrowser.c \ iup_colorhsi.c \ iup_colorbrowserdlg.c \ iupmat_key.c \ iupmat_mark.c \ iupmat_aux.c \ iupmat_mem.c \ iupmat_mouse.c \ iupmat_numlc.c \ iupmat_colres.c \ iupmat_draw.c \ iupmat_focus.c \ iupmat_getset.c \ iupmatrix.c \ iupmat_scroll.c \ iupmat_edit.c \ iup_im.c \ iuplua.c \ iuplua_api.c \ il_tree_aux.c \ il_scanf.c \ il_getparam.c \ il_getcolor.c \ il_button.c \ il_canvas.c \ il_dialog.c \ il_colordlg.c \ il_clipboard.c \ il_filedlg.c \ il_fill.c \ il_frame.c \ il_hbox.c \ il_normalizer.c \ il_item.c \ il_image.c \ il_imagergb.c \ il_imagergba.c \ il_label.c \ il_menu.c \ il_multiline.c \ il_list.c \ il_separator.c \ il_user.c \ il_submenu.c \ il_text.c \ il_toggle.c \ il_vbox.c \ il_zbox.c \ il_timer.c \ il_sbox.c \ il_spin.c \ il_spinbox.c \ il_cbox.c \ il_messagedlg.c \ il_radio.c \ il_val.c \ il_tabs.c \ il_fontdlg.c \ il_tree.c \ il_progressbar.c \ il_split.c \ iuplua_cd.c \ iuplua_controls.c \ il_mask.c \ il_matrix_aux.c \ il_dial.c \ il_gauge.c \ il_colorbrowser.c \ il_colorbar.c \ il_matrix.c \ il_cells.c \ iuplua_im.c \ MAIN_IUP_SOURCE = \ plugin-luaiup.cc \ IUP_LIBS = $(LIBXM) -lXpm -lXmu -lXt -lXext -lX11 -lm IUP_LIBS_STATIC = /usr/lib/libXm.a /usr/lib/libXpm.a /usr/lib/libXp.a /usr/lib/libXmu.a /usr/lib/libXt.a /usr/lib/libSM.a /usr/lib/libICE.a /usr/lib/libXext.a /usr/lib/libX11.a /usr/lib/libxcb.a /usr/lib/libXau.a /usr/lib/libXdmcp.a -lm WHOLE_SOURCES = \ $(IM_SOURCES) \ $(CD_SOURCES) \ $(IUP_SOURCES) \ $(MAIN_IUP_SOURCE) MODULES_LIST = \ luaiup.$(SHARED_EXT) \ ifeq ($(DISTRIB),Debian) ifeq ($(SYSTEM),Linux) MODULES_LIST += luaiup-static.$(SHARED_EXT) endif endif ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES)))) ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES)))) all: dep modules dist: modules mkdir -p ../lua-interface-dist $(STRIP) $(MODULES_LIST) cp $(MODULES_LIST) ../lua-interface-dist modules: $(MODULES_LIST) dep: $(ALL_DEPS) luaiup.a: $(addsuffix .o, $(notdir $(basename $(IM_SOURCES) $(CD_SOURCES) $(IUP_SOURCES)))) $(AR) $@ $+ luaiup.$(SHARED_EXT): plugin-luaiup.o luaiup.a $(LD) $(LDFLAGS) -o $@ $+ $(IM_LIBS) $(CD_LIBS) $(IUP_LIBS) luaiup-static.$(SHARED_EXT): plugin-luaiup.o luaiup.a $(LD) $(LDFLAGS) -o $@ $+ $(IM_LIBS_STATIC) $(CD_LIBS_STATIC) $(IUP_LIBS_STATIC) clean: rm -f *.o *.dep *.so *.dylib *.a %.dep : %.c $(CC) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< %.dep : %.cpp $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< %.dep : %.cc $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< %.c : %.lua bin2c $< $@ $(basename $@) -include $(ALL_DEPS) .PHONY: dist clean