Makefile para FWH y MinGW gcc

Makefile para FWH y MinGW gcc

Postby Antonio Linares » 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
Code: Select all  Expand view  RUN
# 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42161
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Sep 24, 2008 11:26 am

make.bat
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42161
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sun Sep 28, 2008 8:12 am

Una nueva versión del Makefile que ya construye los EXEs. Solo falta ya procesar los ficheros RC usados:

Makefile
Code: Select all  Expand view  RUN
# 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42161
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Sep 29, 2008 6:49 am

Una nueva versión más simple y mejor organizada :-)

Makefile
Code: Select all  Expand view  RUN
# 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42161
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Sep 29, 2008 7:03 am

Aún más simple :-)

Makefile
Code: Select all  Expand view  RUN
# 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42161
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 62 guests