Makefiles

From HotDec

Jump to: navigation, search

This is just a template makefile for use in the lab:


NAME = truckserv
EXENAME = $(NAME).exe

FILES = main.c ../include/unp.cpp
HEADERS = ../include/unp.h

FLAGS = -g

#this is only set if compiling on WIN32/MinGW
ifneq "$(shell uname | grep MINGW)" ""
WIN32FLAGS = -lwsock32
endif


all:$(EXENAME)

load%: $(EXENAME)
	scp $(EXENAME) root@192.168.0.20$*:/tmp
	touch load$*

$(EXENAME):$(FILES) $(HEADERS)
	g++ -o $(EXENAME) $(FLAGS) $(FILES) $(WIN32FLAGS)

clean:
	-rm *.o *.exe *~ new.output

#testing routines
test: new.output
	diff -Naurs output new.output | tee test

new.output: $(EXENAME)
	./$(EXENAME) 2>&1 | cat - > new.output

.PHONY:clean

Personal tools