I'm running this makefile in WinXP:
Package=killerapp
Sources=main.c
Resource=resource\resource.rc
Objs=$(Sources:.c=.o)
Res_obj=$(notdir $(Resource:.rc=.o))
CC_RES=windres
CC=gcc
CFLAGS=
LDFLAGS=-mwindows
%.o.c:
$(CC) $(CFLAGS) -c $<
$(Res_obj): $(Resource)
$(CC_RES) $< -o $@
$(Package): $(Objs) $(Res_obj)
$(CC) $(LDFLAGS) $^ -o $@
all:
$(MAKE) $(Package)
clean:
@del $(Objs)
@del $(Res_obj)
@del $(Package).exe
My idea is to first compile the resource file and later the source files, but seems that only windres is run and the source files are not compiled, any ideas?
Updated #1: This work as expected.
Package=killerapp
Sources=main.c
Resource=resource\resource.rc
Objs=$(Sources:.c=.o)
Res_obj=$(notdir $(Resource:.rc=.o))
CC_RES=windres
CC=gcc
CFLAGS=-O2 -Wall -Werror
LDFLAGS=-mwindows
all: $(Package)
%.o: %.c
$(CC) $(CFLAGS) -c $<
$(Res_obj): $(Resource)
$(CC_RES) $< -o $@
$(Package): $(Res_obj) $(Objs)
$(CC) $(LDFLAGS) $^ -o $@
clean:
@del $(Objs)
@del $(Res_obj)
@del $(Package).exe
run: $(Package)
./$^