Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jun 2005
CXX = g++ LIBS = -L$(SYSTEMC_HOME)/lib-$(TARGET_ARCH) -lsystemc INC = -I$(SYSTEMC_HOME)/include SOURCES = file1.cpp file2.cpp OBJS:=$(SOURCES:%.cpp=%.o) all:$(OBJS) file1.o: $(CXX) $(INC) -c file1.cpp file2.o: $(CXX) $(INC) -c file2.cpp .PHONY: clean clean: rm -f *.o
- Join Date
- Jun 2012
- SF Bay area
Here's a Makefile I came up with a couple of months ago that seems related to what you're trying to do. I can just add a program name to the list at the time and all the rules to compile and link work for whichever one I "make". You might be able to copy bits and pieces out.
PROGS = capture-udp-port send-udp-message capture-udpv6-port send-udpv6-message capture-udp-port-hex capture-udpv6-port-hex # --- CC = gcc LD = gcc CFLAGS = -g -Wall -pedantic LDFLAGS = # --- default: @echo "You can make any of the following programs: $(PROGS)" # --- .PHONY: all all: $(PROGS) # --- %.o : %.c Makefile $(CC) -c -o $@ $(CFLAGS) $< $(PROGS) : % : %.o $(CC) -o $@ $(@).o $(LDFLAGS) # --- clean: rm $(PROGS) *.o