FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Makefile para FWH y MinGW gcc
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Makefile para FWH y MinGW gcc
Posted: Wed Sep 24, 2008 11:17 AM
Aqui teneis un primer prototipo de un Makefile para FWH y gcc.

Observad que la "M" ha de ser mayuscula. Para construirlo haced:
c:\mingw\bin\mingw32-make.exe. Para facilitarlo, nosotros hemos creado un make.bat que tan solo llama a c:\mingw\bin\mingw32-make.exe. Tambien prestad atención a que los "espacios de la izquierda" son "tabs" en vez de espacios.

El plan es construir un EXE a partir de one.prg, two.prg y three.c (el tercer fichero es un fichero en C que queremos incluir en el EXE). No estamos construyendo el EXE desde este Makefile aún. Solo estamos compilando, de momento.

Makefile
# gcc make example for Windows, developed by FiveTech Software

all : test.exe

PRG_OBJS = ./obj/one.c  \
					 ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)

./obj/%.c : %.prg
	if not exist obj mkdir obj
	c:\harbour\source\main\w32\mingw32\harbour.exe $< -o$@ -n -Ic:\harbour\include -Ic:\fwh\include
	
./obj/%.o : ./obj/%.c
	gcc -c -o$@ -Ic:\harbour\include $<	
	
./obj/%.o : %.c
	gcc -c -o$@ -Ic:\harbour\include $<
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Makefile para FWH y MinGW gcc
Posted: Wed Sep 24, 2008 11:26 AM
make.bat
set oldpath=%path%
set path=c:\mingw\bin;%path%
c:\mingw\bin\mingw32-make.exe
set path=%oldpath%
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Makefile para FWH y MinGW gcc
Posted: Sun Sep 28, 2008 08:12 AM
Una nueva versión del Makefile que ya construye los EXEs. Solo falta ya procesar los ficheros RC usados:

Makefile
# gcc make example for Windows, developed by FiveTech Software

hdir=c:\harbour
hdirc=$(hdir)\source\main\w32\mingw32\harbour.exe
hlibs=$(hdir)\lib\w32\mingw32
fwh=c:\fwh
mingw=c:\mingw

all : test.exe
	test.exe

PRG_OBJS = ./obj/one.c  \
					 ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)
	if not exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group
	if exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o _one.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group

./obj/%.c : %.prg
	if not exist obj mkdir obj
	$(hdir)\source\main\w32\mingw32\harbour.exe $< -o$@ -n -I$(hdir)\include -I$(fwh)\include
	
./obj/%.o : ./obj/%.c
	gcc -c -o$@ -I$(hdir)\include $<	
	
./obj/%.o : %.c
	gcc -c -o$@ -I$(hdir)\include $<
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Makefile para FWH y MinGW gcc
Posted: Mon Sep 29, 2008 06:49 AM
Una nueva versión más simple y mejor organizada :-)

Makefile
# gcc make example for Windows, developed by FiveTech Software

hdir=c:\harbour\harbour
hdirc=$(hdir)\source\main\w32\mingw32\harbour.exe
hlibs=$(hdir)\lib\w32\mingw32
fwh=c:\fwh
mingw=c:\mingw
fwfiles=-lfivehg -lfivehgc
w32files=-ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm \
         -lvfw32 -lwsock32 -lmsimg32
hbfiles=-lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx \
        -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 \
        -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 \
        -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb

all : test.exe
	test.exe

PRG_OBJS = ./obj/one.c  \
		 ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)
	if not exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o \
	-Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group \
	$(fwfiles) -lgtgui $(w32files) $(hbfiles) -Wl,--end-group
	if exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o _one.o \
	-Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group \
	$(fwfiles) -lgtgui $(w32files) $(hbfiles) -Wl,--end-group

./obj/%.c : %.prg
	if not exist obj mkdir obj
	$(hdir)\source\main\w32\mingw32\harbour.exe $< -o$@ -n -I$(hdir)\include -I$(fwh)\include
	
./obj/%.o : ./obj/%.c
	gcc -c -o$@ -I$(hdir)\include $<	
	
./obj/%.o : %.c
	gcc -c -o$@ -I$(hdir)\include $<
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Makefile para FWH y MinGW gcc
Posted: Mon Sep 29, 2008 07:03 AM
Aún más simple :-)

Makefile
# gcc make example for Windows, developed by FiveTech Software

hdir=c:\harbour\harbour
hdirc=$(hdir)\source\main\w32\mingw32\harbour.exe
hlibs=$(hdir)\lib\w32\mingw32
fwh=c:\fwh
mingw=c:\mingw
fwfiles=-lfivehg -lfivehgc
w32files=-ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid \
         -lwinmm -lvfw32 -lwsock32 -lmsimg32
hbfiles=-lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf \
     -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip \
     -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 \
     -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb
libraries=$(fwfiles) -lgtgui $(w32files) $(hbfiles)
libspath=-L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib

all : test.exe
	test.exe

PRG_OBJS = ./obj/one.c  \
		 ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)
	if not exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o \
	-Wall -s -mwindows $(libspath) -mno-cygwin -Wl,--start-group $(libraries) -Wl,--end-group
	if exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o _one.o \
	-Wall -s -mwindows $(libspath) -mno-cygwin -Wl,--start-group $(libraries) -Wl,--end-group

./obj/%.c : %.prg
	if not exist obj mkdir obj
	$(hdir)\source\main\w32\mingw32\harbour.exe $< -o$@ -n -I$(hdir)\include -I$(fwh)\include
	
./obj/%.o : ./obj/%.c
	gcc -c -o$@ -I$(hdir)\include $<	
	
./obj/%.o : %.c
	gcc -c -o$@ -I$(hdir)\include $<
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion