# Title: Makefile
# Author: Jed Marti KI7NNP
# Description: Makefile for Windows/Linux. Uncomment the section you wish to use. Defaults to Linux.
# Revision History:
#   Sun Jan 28 10:01:19 2024 - Cleanup for publication.
#   Tue Feb 13 14:21:08 2024 - One more time for Windows.

# Windows 10 32 bits. Assumes you've added the binaries to the search path.
# You should run  vcvars32.bat before doing any of this.
#CC = cl
#O = obj
#EXE = .exe
#CFLAGS = /Ox /EHsc /MT /W3 /nologo /c /TC /D "_CONSOLE" /D "_MBCS" /D "WINTEL" /D "_CRT_SECURE_NO_DEPRECATE"
#RM = del /Q
#CP = copy
#BIN = c:\local
#LFLAGS = /link /OPT:REF /SUBSYSTEM:CONSOLE /MACHINE:IX86 kernel32.lib user32.lib


# Linux,
CC = cc
O = o
EXE =
CFLAGS = -O2
RM = rm -rf
CP = cp
BIN = /usr/local/bin
LFLAGS = -lm

OBJS =	bestind.$(O) \
	cmdline.$(O) \
	equations.$(O) \
	readind.$(O) \
	wire.$(O)


all:	$(OBJS) compare$(EXE) inductor$(EXE)

# Install the programs 
install:
	$(CP) compare$(EXE) $(BIN)/compare
	$(CP) inductor$(EXE) $(BIN)/inductor

clean:
	$(RM) *.$(O)
	$(RM) compare$(EXE)
	$(RM) inductor$(EXE)

bestind.$(O):	inductor.h equations.h bestind.c

cmdline.$(O):	inductor.h cmdline.c

equations.$(O):	equations.h equations.c

readind.$(O):	compare.h equations.h readind.c

wire.$(O):	inductor.h wire.c

compare$(EXE):	$(OBJS) compare.h compare.$(O)
	$(CC) -c $(CFLAGS) compare.c
	$(CC) -o compare$(EXE) compare.$(O) readind.$(O) equations.$(O) $(LFLAGS)

inductor$(EXE):	$(OBJS) equations.h inductor.h inductor.$(O)
	$(CC) -c $(CFLAGS) inductor.c
	$(CC) -o inductor$(EXE) inductor.$(O) $(OBJS) $(LFLAGS)
