all: myapp
# which compiler
cc=gcc
#where to install
INSTDIR= /usr/local/bin
#where are include files kept
INCLUDE = .
#Options for development
CFLAGS = -g -Wall -ansi
#Options for release
# CFLAGs = -o -Wall -ansi
myapp: main.o 2.o 3.o
$(cc) -o myapp main.o 2.o 3.o
main.o: main.c a.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c main.c
2.o: 2.c a.h b.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c 2.c
3.o: 3.c b.h c.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c 3.c
clean:
-rm *.o
install: myapp
@if [-d $(INSTDIR)];\
then \
cp myapp $(INSTDIR);\
chmod a+x $(INSTDIR)/myapp;\
chmod og-w $(INSTDIR)/myapp;\
echo "Install in $(INSTDIR)";\
else \
echo "Sorry,$(INSTDIR) does not exist";\
fi
# which compiler
cc=gcc
#where to install
INSTDIR= /usr/local/bin
#where are include files kept
INCLUDE = .
#Options for development
CFLAGS = -g -Wall -ansi
#Options for release
# CFLAGs = -o -Wall -ansi
myapp: main.o 2.o 3.o
$(cc) -o myapp main.o 2.o 3.o
main.o: main.c a.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c main.c
2.o: 2.c a.h b.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c 2.c
3.o: 3.c b.h c.h
$(cc) -I$(INCLUDE) $(CFLAGS) -c 3.c
clean:
-rm *.o
install: myapp
@if [-d $(INSTDIR)];\
then \
cp myapp $(INSTDIR);\
chmod a+x $(INSTDIR)/myapp;\
chmod og-w $(INSTDIR)/myapp;\
echo "Install in $(INSTDIR)";\
else \
echo "Sorry,$(INSTDIR) does not exist";\
fi