blob: 41c1430e5e6e1e85c06a076d62e7b621c55ae51c [file] [log] [blame]
# Global rules shared by all makefiles
# The makefile must define at least TOPSRC and MODULE
# First some useful definitions
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
WINELIB = -L$(TOPSRC) -lwine
LDLIBS = @LDLIBS@
YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@
DIVINCL = -I$(TOPSRC)/include
ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
LDCOMBINE = ld -r
RM = rm -f
BUILD = $(TOPSRC)/tools/build
WINERC = $(TOPSRC)/rc/winerc
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
# Implicit rules
.SUFFIXES: .rc
.c.o:
$(CC) -c $(ALLCFLAGS) -o $*.o $<
.S.o:
$(CC) -c -o $*.o $<
.rc.c:
echo "#include \"windows.h\"" >winerctmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c
cat $< >>winerctmp.c
$(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(RM) winerctmp.c
.rc.h:
echo "#include \"windows.h\"" >winerctmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c
cat $< >>winerctmp.c
$(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(RM) winerctmp.c
# Rule to rebuild resource compiler
$(WINERC) check_winerc:
cd $(TOPSRC)/rc; $(SUBMAKE) winerc
# Rule for main module
$(MODULE).o: $(OBJS)
$(LDCOMBINE) $(OBJS) -o $(MODULE).o
# Misc. rules
depend:: $(C_SRCS)
sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
$(CC) $(ALLCFLAGS) -MM $(C_SRCS) >> tmp_make
mv tmp_make Makefile
clean::
$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c
dummy:
# End of global rules