Created
November 30, 2014 23:41
-
-
Save Sammons/be6f994fb0cae0e2f233 to your computer and use it in GitHub Desktop.
junky gist to make two binaries
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
# compiler | |
# clang rocks, try it sometime | |
# clang, gcc, cc, etc. | |
CC = gcc | |
# these are C++ flags | |
# -std=c++11 -ggdb `pkg-config --cflags opencv` | |
CFLAGS = | |
# other includes you want in the command to compile | |
INCLUDES = | |
# linker flags | |
LFLAGS = | |
# i use things like boost here | |
# -lboost_system -lboost_filesystem `pkg-config --libs opencv` | |
LIBS = | |
#I recommend renaming everything to something | |
# besides first and second | |
# every .c file you need for the binaries | |
FIRST_SRCS = fileone.c filetwo.c | |
SECOND_SRCS = filethree.c filefour.c | |
# the object names | |
FIRST_OBJS = $(FIRST_SRCS:.c=.o) | |
SECOND_OBJS = $(SECOND_SRCS:.c=.o) | |
FIRST = outputbinaryname | |
SECOND = otheroutputbinary | |
# default make command since first target | |
all: $(FIRST) $(SECOND) | |
@echo Success | |
$(FIRST): $(FIRST_OBJS) | |
$(CC) $(CFLAGS) $(INCLUDES) -o $(SECOND) $(FIRST_OBJS) $(LFLAGS) $(LIBS) | |
$(SECOND): $(SECOND_OBJS) | |
$(CC) $(CFLAGS) $(INCLUDES) -o $(FIRST) $(SECOND_OBJS) $(LFLAGS) $(LIBS) | |
.c.o: | |
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ | |
clean: | |
$(RM) *.o *~ $(FIRST) $(SECOND) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment