104 lines
2.8 KiB
Makefile
104 lines
2.8 KiB
Makefile
# Global rules shared by all makefiles -*-Makefile-*-
|
|
#
|
|
# Each individual makefile should define the following variables:
|
|
# TOPSRCDIR : top-level source directory
|
|
# TOPOBJDIR : top-level object directory
|
|
# SRCDIR : source directory for this module
|
|
# MODULE : name of the module being built
|
|
# C_SRCS : C sources for the module
|
|
# GEN_C_SRCS : generated C sources (optional)
|
|
# ASM_SRCS : assembly sources (optional)
|
|
# GEN_ASM_SRCS : generated assembly sources (optional)
|
|
# EXTRA_OBJS : extra object files (optional)
|
|
|
|
# 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 = $(WINESTUB) $(TOPOBJDIR)/@MAIN_TARGET@
|
|
LDLIBS = @LDLIBS@
|
|
YACC = @YACC@
|
|
LEX = @LEX@
|
|
LEXLIB = @LEXLIB@
|
|
DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
|
|
ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
|
|
LDCOMBINE = ld -r
|
|
RM = rm -f
|
|
BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
|
|
MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
|
|
WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
|
|
WINESTUB = $(TOPOBJDIR)/library/winestub.o
|
|
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
|
|
@SET_MAKE@
|
|
|
|
OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) \
|
|
$(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
|
|
|
|
# Implicit rules
|
|
|
|
.SUFFIXES: .rc
|
|
|
|
.c.o:
|
|
$(CC) -c $(ALLCFLAGS) -o $*.o $<
|
|
|
|
.s.o:
|
|
$(CC) -c -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) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -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) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
|
|
$(RM) winerctmp.c
|
|
|
|
|
|
# Rule to rebuild resource compiler
|
|
|
|
$(WINERC) check_winerc:
|
|
cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
|
|
|
|
# Rule to rebuild the 'makedep' program
|
|
|
|
$(MAKEDEP) check_makedep:
|
|
cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
|
|
|
|
# Rule to rebuild the 'build' program
|
|
|
|
$(BUILD) checkbuild:
|
|
cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
|
|
|
|
# Rule for main module
|
|
|
|
$(MODULE).o: $(OBJS)
|
|
$(LDCOMBINE) $(OBJS) -o $(MODULE).o
|
|
|
|
|
|
# Misc. rules
|
|
|
|
depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
|
|
$(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
|
|
|
|
clean::
|
|
$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(GEN_ASM_SRCS) $(PROGRAMS)
|
|
|
|
dummy:
|
|
|
|
# End of global rules
|