Created
August 12, 2013 04:33
-
-
Save zeta709/6208265 to your computer and use it in GitHub Desktop.
Makefile for c and cpp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run 'make -p' to see make's default variables | |
| #COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c | |
| #LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH) | |
| CFLAGS = -std=c99 -Wall -Wextra -O2 | |
| LDLIBS = | |
| TARGET = main | |
| SRCS = main.c mylib.c | |
| OBJS = $(SRCS:.c=.o) | |
| .PHONY: all clean dep | |
| all: $(TARGET) | |
| $(TARGET): $(OBJS) | |
| $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ | |
| # $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ | |
| # $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ | |
| clean: | |
| $(RM) $(OBJS) | |
| dep: | |
| $(CC) -MM $(SRCS) > .depend | |
| ifeq (.depend,$(wildcard .depend)) | |
| include .depend | |
| endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment