changed to new STARTER design
This commit is contained in:
		
							
								
								
									
										65
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										65
									
								
								Makefile
									
									
									
									
									
								
							| @@ -1,35 +1,46 @@ | |||||||
| CC=gcc | BIN := ranlin | ||||||
| CXX=g++ |  | ||||||
| RM=rm -f |  | ||||||
| CP=cp |  | ||||||
| MKDIR=mkdir -p |  | ||||||
| CXXFLAGS=-Wall -O2 -std=c++11 |  | ||||||
| LDFLAGS= |  | ||||||
| LDLIBS= |  | ||||||
|  |  | ||||||
| TOOL=ranlin | SRCS := main.cpp | ||||||
| SRCS=main.cpp | OBJS := $(subst .cpp,.o,$(SRCS)) | ||||||
| OBJS=$(subst .cpp,.o,$(SRCS)) | DEPS := $(subst .cpp,.d,$(SRCS)) | ||||||
|  |  | ||||||
| all: $(TOOL) | CXX ?= g++ | ||||||
|  | PKG_CONFIG ?= pkg-config | ||||||
|  |  | ||||||
| $(TOOL): $(OBJS) | PREFIX ?= /usr/local | ||||||
| 	$(CXX) $(LDFLAGS) -o $(TOOL) $(LDLIBS) $(OBJS)  | BINDIR ?= ${PREFIX}/bin | ||||||
|  | DATADIR ?= ${PREFIX}/share | ||||||
|  | MANDIR ?= ${DATADIR}/man | ||||||
|  |  | ||||||
| depend: .depend | RM := /bin/rm -f | ||||||
|  | INSTALL := /usr/bin/install -c | ||||||
|  |  | ||||||
| .depend: $(SRCS) | CXXFLAGS := ${CXXFLAGS} -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++14 -pthread | ||||||
| 	$(RM) ./.depend | ifeq ($(DEBUG),1) | ||||||
| 	$(CXX) $(CXXFLAGS) -MM $^>>./.depend; | 	CXXFLAGS += -D DEBUG -O0 | ||||||
|  | else | ||||||
|  | 	CXXFLAGS += -O3 | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | LDLIBS := -lm -lpthread -lcommon | ||||||
|  | LDFLAGS := | ||||||
|  |  | ||||||
|  | all: $(BIN) | ||||||
|  |  | ||||||
|  | $(BIN): $(OBJS) $(DEPS) | ||||||
|  | 	$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN) | ||||||
|  |  | ||||||
|  | %.o: %.cpp %.d Makefile | ||||||
|  | 	$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< | ||||||
|  |  | ||||||
|  | -include *.d | ||||||
|  |  | ||||||
|  | %.d: ; | ||||||
|  |  | ||||||
|  | .PHONY: clean install | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	$(RM) $(OBJS) | 	$(RM) $(OBJS) $(DEPS) $(BIN) | ||||||
|  |  | ||||||
| dist-clean: clean | install: $(BIN) | ||||||
| 	$(RM) *~ ./.depend $(TOOL) | 	$(INSTALL) $(BIN) $(DESTDIR)$(BINDIR) | ||||||
|  |  | ||||||
| install: |  | ||||||
| 	$(RM) ~/bin/$(TOOL) |  | ||||||
| 	$(CP) $(TOOL) ~/bin/ |  | ||||||
|  |  | ||||||
| include .depend |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user