#
#	Makefile for GNU Make
#

srcdir = .
VPATH = .

release:
	$(MAKE) -f Makefile.os2 all CC="gcc -s -O" O=".o"
debug:
	$(MAKE) -f Makefile.os2 all CC="gcc -g" O=".o"
os2only:
	$(MAKE) -f Makefile.os2 all CC="gcc -s -O -Zomf -Zmtd" O=".obj"

CFLAGS = -DHAVE_CONFIG_H -DINCLUDEDIR=\"/emx/include\" -DLIBDIR=\"/emx/lib\"

# If you are using the GNU C library, or have the GNU getopt functions in
# your C library, you can comment these out.
GETOPT = getopt$O getopt1$O
GETOPT_SRC = $(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/getopt.h

# If you are using the GNU C library, or have the GNU glob functions in
# your C library, you can comment this out.  GNU make uses special hooks
# into the glob functions to be more efficient (by using make's directory
# cache for globbing), so you must use the GNU functions even if your
# system's C library has the 1003.2 glob functions already.  Also, the glob
# functions in the AIX and HPUX C libraries are said to be buggy.
GLOB = glob/glob$O glob/fnmatch$O

# If your system doesn't have alloca, or the one provided is bad, define this.
ALLOCA = 
ALLOCA_SRC = 

# If your system needs extra libraries loaded in, define them here.
# System V probably need -lPW for alloca.  HP-UX 7.0's alloca in
# libPW.a is broken on HP9000s300 and HP9000s400 machines.  Use
# alloca.c instead on those machines.
LOADLIBES = make.def

# If there are remote execution facilities defined,
# enable them with switches here (see remote-*.c).
REMOTE = stub

# Any extra object files your system needs.
extras = 

# Whether or not make needs to be installed setgid.
# The value should be either `true' or `false'.
# On many systems, the getloadavg function (used to implement the `-l'
# switch) will not work unless make is installed setgid kmem.

objs = commands$O job$O dir$O file$O misc$O main$O read$O remake$O	\
       remote$O rule$O implicit$O default$O variable$O expand$O		\
       function$O vpath$O version$O ar$O arscan$O signame$O		\
       getloadavg$O $(GLOB) $(GETOPT) $(ALLOCA) $(extras)

.PHONY: all
all: make.exe

make.exe : $(objs)
	$(CC) $(LDFLAGS) $(objs) $(LOADLIBES) -o $@


# -I. is needed to find config.h in the build directory.
%$O: %.c
	$(CC) -c -I. -I$(srcdir) -I$(srcdir)/glob \
	      $(CFLAGS) $< $(OUTPUT_OPTION)
remote$O: remote-$(REMOTE).c
	$(CC) -c -I. -I$(srcdir) \
	      $(CFLAGS) $(srcdir)/remote-$(REMOTE).c $(OUTPUT_OPTION)

# For some losing Unix makes.
MAKE = make

glob/glob$O glob/fnmatch$O: 
	$(MAKE) -C glob -f Makefile.os2 CC="$(CC)" O="$(O)"

config.h:

# This tells versions [3.59,3.63) of GNU make not to export all variables.
.NOEXPORT:

# Automatically generated dependencies will be put at the end of the file.

# Automatically generated dependencies.
commands$O : commands.c make.h config.h dep.h commands.h file.h variable.h \
  job.h 
job$O : job.c make.h config.h commands.h job.h file.h variable.h 
dir$O : dir.c make.h config.h 
file$O : file.c make.h config.h commands.h dep.h file.h variable.h 
misc$O : misc.c make.h config.h dep.h 
main$O : main.c make.h config.h commands.h dep.h file.h variable.h job.h \
  getopt.h 
read$O : read.c make.h config.h commands.h dep.h file.h variable.h glob/glob.h 
remake$O : remake.c make.h config.h commands.h job.h dep.h file.h 
remote$O : remote-$(REMOTE).c make.h commands.h 
rule$O : rule.c make.h commands.h dep.h file.h variable.h rule.h 
implicit$O : implicit.c make.h config.h rule.h dep.h file.h 
default$O : default.c make.h config.h rule.h dep.h file.h commands.h variable.h 
variable$O : variable.c make.h config.h commands.h variable.h dep.h file.h 
expand$O : expand.c make.h config.h commands.h file.h variable.h 
function$O : function.c make.h config.h variable.h dep.h commands.h job.h 
vpath$O : vpath.c make.h config.h file.h variable.h 
version$O : version.c 
ar$O : ar.c make.h file.h 
arscan$O : arscan.c make.h config.h 
signame$O : signame.c signame.h 
getopt$O : getopt.c config.h getopt.h 
getopt1$O : getopt1.c config.h getopt.h 
getloadavg$O : getloadavg.c config.h 
