Hola
aqui te dejo un ejemplo de como crear la lib
estructura del directorio
- Code: Select all Expand view RUN
raiz
|->goclean.bat (limpia directorios y builds)
|->golib.bat (construye la lib desde los fuentes)
|->makefile (archivo del make)
|->win-make.exe (mismo ejecutable que proporciona harbour para use archivos make)
|->lib (directorio donde se creara la lib)
|->source
|->c (directorio que contiene archivos .c)
|->cpp (directorio que contiene archivos .cpp)
|->prg (directorio que contiene archivos .prg)
edita makefile y proporciona nombre de la lib (LIBNAME) y arregla los path segun tu conveniencia, la variable "SRC_FILES_PRG" se le asigna los nombres de los PRG (separados por espacios) sin la extencion, igual para las variables "SRC_FILES_C" y "SRC_FILES_CPP"
puedes decargarlo de aqui
http://sitasoft.net/fivewin/files/makesvc.zipdejo aqui los fuentes makefile, golib y goclean
makefile
- Code: Select all Expand view RUN
#delcare user variables
USER_DEFINE=
LIBNAME=test
#
PRG_SOURCE_PATH=.\source\prg
C_SOURCE_PATH=.\source\c
CPP_SOURCE_PATH=.\source\cpp
OBJ_PATH=.\obj
HBDIR=c:\hb30
HBLIB=$(HBDIR)\lib\win\msvc
FWDIR=c:\fwh
FWINC=$(FWDIR)\include
CC=cl
LD=link
AR=lib
LIB_FLAGS= /OUT:lib\$(LIBNAME).lib $(filter %.obj,$^)
CC_FLAGS=-nologo -c -TP -W3 -GA -I$(HBDIR)\include -I.\include -I$(VCDIR)\include
#should use tabs to indent lines
#we dont need extention
SRC_FILES_PRG=one two three
SRC_FILES_C=myc
SRC_FILES_CPP=
OBJ_FILES = $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_PRG))))\
$(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_C))))\
$(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_CPP))))
PRG_COMP_CMD=$(HBDIR)\bin\harbour $< /q0 /n /W /O$(OBJ_PATH)\ /I$(HBDIR)\include;.\include;$(FWINC) $(USER_DEFINE)
MSVC_LIB_DEF=$(AR) /DEF:lib\$(LIBNAME).def /OUT:lib\$(LIBNAME).lib
LIB_CMD=$(AR) $(LIB_FLAGS)
define HAR_CMD
@echo $(PRG_COMP_CMD) $< >> make.log
@$(PRG_COMP_CMD) >> make.log
endef
define LIB_CMD1
@$(MSVC_LIB_DEF) >> make.log
@$(LIB_CMD) >> make.log
@echo. >> make.log
endef
.PHONY: lib clean
lib : logfile builddef $(LIBNAME)
#is extremely necessary ident with tab inside targer-pattern
#should use tabs to indent lines
logfile:
@echo. > make.log
@echo # ----------------------------------------------------------------------- >> make.log
@echo # Building $(LIBNAME) >> make.log
@echo # ----------------------------------------------------------------------- >> make.log
$(info ----------------------------------------------------------------------- )
$(info Building $(LIBNAME) )
$(info ----------------------------------------------------------------------- )
$(LIBNAME): $(OBJ_FILES)
$(info Linking $(LIBNAME) )
@$(LIB_CMD1)
@echo $(LIB_CMD) >> make.log
$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.prg
$(info Compiling $< )
@$(HAR_CMD)
$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.PRG
$(info Compiling $< )
@$(HAR_CMD)
$(OBJ_PATH)%.obj: $(OBJ_PATH)%.c
@echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
@$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
@echo ========================================= >> make.log
$(OBJ_PATH)%.obj: $(C_SOURCE_PATH)%.c
@echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
@$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
$(info Compiling $< )
$(OBJ_PATH)%.obj: $(CPP_SOURCE_PATH)%.cpp
@echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
@$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
$(info Compiling $< )
builddef:
@echo LIBRARY $(LIBNAME) > lib\$(LIBNAME).def
@echo. >> lib\$(LIBNAME).def
@echo EXPORTS >> lib\$(LIBNAME).def
@echo. >> lib\$(LIBNAME).def
@echo dummy @1 >> lib\$(LIBNAME).def
clean:
@if EXIST obj\*.* del /F /Q obj\*.*
@if EXIST lib\*.* del /F /Q lib\*.*
@if EXIST *.bak del /F /Q *.bak
@if EXIST *.log del /F /Q *.log
golib.bat
- Code: Select all Expand view RUN
@echo off
@rem use %ProgramFiles(x86)% or %ProgramFiles%
@SET PROGRAMFILE=%ProgramFiles%
@SET OLD_PATH=%PATH%
@SET CC_COMP="%PROGRAMFILE%\Microsoft Visual Studio 10.0\vc"
@IF EXIST %CC_COMP%\vcvarsall.bat GOTO CALLVC ELSE GOTO NOFOUND
:READY
@if not exist obj md obj
@if not exist lib md lib
@CALL win-make
@GOTO FINISHED
:CALLVC
@call %CC_COMP%\vcvarsall.bat
@GOTO READY
:NOFOUND
@echo can not find %CC_COMP%\vcvarsall.bat
@GOTO FINISHED
:ERROR
@echo Error building app
:FINISHED
@SET PATH=%OLD_PATH%