# $@ is the name of the file to be made
# $? are the names of the changed dependents
# $< is the name of the related file that caused the action
# $* is the prefix shared by target and dependent files

# developper has to change the following two lines:
SOURCES=snmp.c
EXECUTABLE=snmp

# nothing has to be done for the following lines:
CC=gcc
CFLAGS=-c -Wall -g `net-snmp-config --cflags`
LDFLAGS=`net-snmp-config --libs` `net-snmp-config --external-libs`
OBJECTS=$(SOURCES:.c=.o)

all: $(SOURCES) $(EXECUTABLE)
	rm -rf $(OBJECTS)
	rm -rf *~ *.bak core
	rm -rf vypis.log

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.c.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm -rf $(OBJECTS) $(EXECUTABLE)
	rm -rf *~ *.bak core
	rm -rf vypis.log