Çë½Ì¹ØÓÚmakefileµÄÎÊÌâ
ÎÒÊǸö³õѧÕߣ¬¶ÔlinuxºÜ¸ÐÐËȤµ«ÊÇѧÆðÀ´ºÜÍ·Í´£¬ÌرðÊǹØÓÚmakefileÎļþ# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
# This Makefile has been simplified as much as possible, by putting all
# generic material, independent of this specific directory, into
# ../Rules.make. Read that file for details
TOPDIR := $(shell cd ..; pwd)
include $(TOPDIR)/Rules.make
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
CFLAGS += $(DEBFLAGS)
CFLAGS += -I..
TARGET = scull
OBJS = $(TARGET).o
SRC = main.c pipe.c access.c
all: .depend $(TARGET).o
$(TARGET).o: $(SRC:.c=.o)
$(LD) -r $^ -o $@
install:
install -d $(INSTALLDIR)
install -c $(TARGET).o $(INSTALLDIR)
clean:
rm -f *.o *~ core .depend
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
ifeq (.depend,$(wildcard .depend))
include .depend
endif
Óм¸´¦¿´²»Ì«¶®
1 all: .depend $(TARGET).o ¾Ý˵makefileÊÇ´ÓÕâÀ↑ʼִÐе쬵«ÊDz»Öª
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
ÊÇʲôÒâ˼
2 ÕâÊǸö±àÒëÇý¶¯Ä£¿éµÄmakefileËüºÍ±àÒëÒ»°ãµÄÓ¦ÓóÌÐòÓÐÊ²Ã´Çø±ð°¡ ÔõôûÓÐÈ˻ذ¡£¬
Ò³:
[1]