5fc0575e99
Historically $(OBJECTDIR) was created when Makefile.include is read. A consequence is that combining "clean" with "all" (or any other build target) results in an error because the clean removes the object directory that is required to exist when building dependencies. Creating $(OBJECTDIR) on-demand ensures it is present when needed. Removed creation of $(OBJECTDIR) on initial read, and added an order-only dependency forcing its creation all Makefile* rules where the target is explicitly or implicitly in $(OBJECTDIR).
30 lines
569 B
Makefile
30 lines
569 B
Makefile
#
|
|
# Makefile for hexameter
|
|
# @author Takahide Matsutsuka <markn@markn.org>
|
|
#
|
|
# $Id: Makefile,v 1.3 2009/12/15 07:13:14 matsutsuka Exp $
|
|
#
|
|
|
|
#CFLAGS = -std=c99 -g -mno-cygwin -Wall
|
|
CFLAGS = -g -Wall
|
|
SOURCEDIR = src
|
|
SOURCES = hexameter.c ihx2bin.c
|
|
OBJECTDIR = bin
|
|
OBJECTS = ${addprefix $(OBJECTDIR)/,$(SOURCES:.c=.o)}
|
|
|
|
vpath %.c $(SOURCEDIR)
|
|
|
|
hexameter: $(OBJECTS)
|
|
$(CC) $(CFLAGS) -o $@ $(OBJECTS)
|
|
|
|
clean:
|
|
rm -rf bin
|
|
rm -f *~ *.stackdump
|
|
rm -f *~ hexameter hexameter.exe
|
|
|
|
$(OBJECTDIR):
|
|
mkdir $@
|
|
|
|
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|