# Makefile for DMTXLS: DooM TeXture LiSter

# Definitions
CP	= cp -p
# for SunOS use:
# CC	= acc
# for Irix, HP-UX use:
# CC	= cc
# for Linux, Ultrix use:
CC	= gcc

# MinGW GCC cross-compiler to Windows 32- & 64-bit
CC32	= i686-w64-mingw32-gcc
CC64	= x86_64-w64-mingw32-gcc
WINDST	= ../windows/

CFLAGS	= -O
LDFLAGS	= -s

# for SunOS use:
# INCLUDES = /usr/users/sigc/a01/bin/SC1.0/ansi_include
# for Irix, Linux, Ultrix, HP-UX use:
# (none)

# big endian machines (Sun, SGI, HP-UX) need to swap bytes within int's/long's
# DEFINES = -DDM_BIG_ENDIAN
# little endian machines (IBM PC, DECstation) need to do nothing
DEFINES =


# Programs & Objects
PROGSLNX= dmtxls
PROGSWIN= dmtxls32.exe dmtxls64.exe
INCS	= dmtxls.h dmunix.h wstructs.h levels.h
OBJS	= wads.o levels.o list.o
SRCS	= wads.c levels.c list.c dmtxls.c


# Rules & Dependencies
default: $(PROGSLNX)
all:	 $(PROGSLNX) $(PROGSWIN)

dmtxls.o:  dmtxls.h dmunix.h
wads.o:    dmtxls.h dmunix.h
levels.o:  dmtxls.h dmunix.h wstructs.h
list.o:    dmtxls.h dmunix.h wstructs.h levels.h


# Commands
dmtxls: dmtxls.o $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) $@.o -o $@

dmtxls32.exe: $(INCS) $(SRCS)
	$(CC32) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $@
	$(CP) $@ $(WINDST)

dmtxls64.exe: $(INCS) $(SRCS)
	$(CC64) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $@
	$(CP) $@ $(WINDST)

.c.o:
# for SunOS use:
#	$(CC) $(CFLAGS) $(DEFINES) -I$(INCLUDES) -c $<
# for Irix, Linux, Ultrix use:
	$(CC) $(CFLAGS) $(DEFINES) -c $<
# for HP-UX use:
#	$(CC) $(CFLAGS) $(DEFINES) -Aa -c $<


# Remove Objects
clean:
	rm -f *.o
cleanall:
	rm -f *.o dmtxls *.exe $(WINDST)*.exe

