
CFLAGS =

# Un/Comment if you have gcc/other compiler
CC = gcc

# NOTE: if you get errors when linking qstat (missing symbols or
# libraries), then switch the LIBS macro being used.

NO_LIBS =
SOLARIS_LIBS = -lsocket -lnsl
WINDOWS_LIBS = wsock32.lib
OS2_LIBS = so32dll.lib tcp32dll.lib
OS2GCC_LIBS = -lsocket

nothing-specified:
	@echo ""
	@echo "You must specify the system which you want to compile for:"
	@echo ""
	@echo "make generic        Generic Unix Qstat"
	@echo "make solaris        Solaris"
	@echo "make sgi            ->generic"
	@echo "make linux          ->generic"
	@echo "make irix           ->generic"
	@echo "make freebsd        ->generic"
	@echo "make windows        Windows 95/NT"
	@echo "make os2            OS/2 with IBM Visual Age"
	@echo "make os2gcc         OS/2 with GCC+EMX"
	@echo ""

generic sgi freebsd irix linux: qstat.c
	$(CC) $(CFLAGS) -o qstat qstat.c $(NO_LIBS)

solaris: qstat.c
	$(CC) $(CFLAGS) -o qstat qstat.c $(SOLARIS_LIBS)

windows: qstat.c
	$(CC) /ML /c qstat.c
	link qstat.obj /out:qstat.exe $(WINDOWS_LIBS)

os2: qstat.c
	$(CC) /Q /W0 /C+ qstat.c
    link386 /PM:VIO qstat.obj /out:qstat.exe $(OS2_LIBS)

os2gcc:
	$(CC) $(CFLAGS) -o qstat qstat.c $(OS2GCC_LIBS)
	emxbind qstat

clean:
	rm -f qstat core qstat.exe qstat.obj

VERSION = 16b3-emx
WVERSION = 16b3-emx
CP_FILES = Makefile qstat.txt qstatdoc.html qstat.c qstat.h qstat.bat CHANGES.txt COMPILE.txt win32 os2

tar: always
	rm -rf tar
	rm -f qstat$(VERSION).tar qstat$(VERSION).tar.Z
	mkdir tar
	-cp -r $(CP_FILES) tar
	cd tar ; tar cvf ../qstat$(VERSION).tar $(CP_FILES)
	compress qstat$(VERSION).tar

zip: always
	rm -rf zip
	rm -f qsta$(WVERSION).zip qstat$(WVERSION).zip
	mkdir zip
	-cp -r $(CP_FILES) zip
	mv zip/qstatdoc.html zip/qstatdoc.htm
	cd zip ; crtocrlf *
	cd zip ; zip -r ../qsta$(WVERSION).zip $(CP_FILES:%.html=%.htm)

always:
