#
# Generic makefile
#
# by George Foot
# email: george.foot@merton.ox.ac.uk
#
# Copyright (c) 1997 George Foot
# All rights reserved.
#
# No warranty, no liability;
# you use this at your own risk.
#
# You are free to modify and
# distribute this without giving
# credit to the original author.
#
######################################
# Modified by Grip2
### Customising
#
# Adjust the following if necessary; EXECUTABLE is the target
# executable's filename, and LIBS is a list of libraries to link in
# (e.g. alleg, stdcx, iostr, etc). You can override these on make's
# command line of course, if you prefer to do it that way.
#
EXECUTABLE := dt
LIBS := pcap dl iconv
# Now alter any implicit rules' variables if you like, e.g.:
CC := gcc
CFLAGS := -Wall -O2 -Iinclude/ -Werror
CXXFLAGS := $(CFLAGS)
# You shouldn't need to change anything below this point.
SOURCE := $(wildcard *.c */*.c */*/*.c */*/*/*.c)
OBJS := $(patsubst %.c,%.o,$(SOURCE))
DEPS := $(patsubst %.o,%.d,$(OBJS))
MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS)))
CPPFLAGS += -MD
.PHONY : everything deps objs clean veryclean rebuild
everything:$(EXECUTABLE)
deps:$(DEPS)
objs:$(OBJS)
clean:
rm $(EXECUTABLE) -rf
find ./ -name *.o -print -exec rm {} \;
find ./ -name *.d -print -exec rm {} \;
rebuild : veryclean everything
ifneq ($(MISSING_DEPS),)
$(MISSING_DEPS) :
rm $(patsubst %.d,%.o,$@) -rf
endif
-include $(DEPS)
$(EXECUTABLE) : $(OBJS)
gcc -o $(EXECUTABLE) $(OBJS) $(addprefix -l,$(LIBS))
没有评论:
发表评论