我有以下文件:
Child.c,Cookie.c,Cookie.h,CookieMonster.c,Jar.c,Jar.h,Milk.c,Milk.h
和下面的makefile,名为makePractice,它应该创建两个可执行文件,Child和CookieMonster.
makefile:
CC = gcc # the compiler
CFLAGS = -Wall # the compiler flags
ChildObjects = Jar.o # object files for the Child executable
CookieMonsterObjects = Jar.o Milk.o #object files for the CookieMonster executable
all: Child CookieMonster # the first target. Both executables are created when
# 'make' is invoked with no target
# general rule for compiling a source and producing an object file
.c.o:
$(CC) $(CFLAGS) -c $<
# linking rule for the Child executable …Run Code Online (Sandbox Code Playgroud)