品牌:规则中的目标名称

时间:2018-06-30 10:20:18

标签: makefile build gnu-make

我创建了一个Makefile来为所提到的pdf文件生成htmlmd,而调用make之类的make a.md应该会生成a.pdfa.html,并且不应转换目录中存在的其他md文件。

My make file

但是我遇到了错误Nothing to be done for a.md

能否请您建议更改?

1 个答案:

答案 0 :(得分:2)

由于<?php require_once 'db_connect.php'; //if form is submitted if($_POST) { $validator = array('success' => false, 'messages' => array()); $name = $_POST['addName']; $file = ''; $file_name = ''; $file_size = ''; $file_tmp = ''; $file_type = ''; $main_path = "../img/pics/"; $thumb_path = "../img/pics/thumbnail/"; $percent = 0.5; $file_name = $_FILES['addImage']['name']; $file_size = $_FILES['addImage']['size']; $file_tmp = $_FILES['addImage']['tmp_name']; $file_type = $_FILES['addImage']['type']; if ($file_name != '' && $file_size > 1000) { if($file_size > 2097152){ echo "Image size should be less than 2 MB"; } else{ $upload_image = $main_path.basename($file_name); move_uploaded_file($file_tmp,"$main_path".$file_name); $thumbnail = $thumb_path.$file_name; list($width,$height) = getimagesize($upload_image); $thumb_width = $width * $percent; $thumb_height = $height * $percent; $thumb_create = imagecreatetruecolor($thumb_width,$thumb_height); switch($file_type){ case 'image/jpg': $source = imagecreatefromjpeg($upload_image); break; case 'image/jpeg': $source = imagecreatefromjpeg($upload_image); break; case 'image/png': $source = imagecreatefrompng($upload_image); break; case 'image/gif': $source = imagecreatefromgif($upload_image); break; default: $source = imagecreatefromjpeg($upload_image); } imagecopyresampled($thumb_create,$source,0,0,0,0,$thumb_width,$thumb_height,$width,$height); switch($file_type){ case 'image/jpg': imagejpeg($thumb_create,$thumbnail,100); break; case 'image/jpeg': imagejpeg($thumb_create,$thumbnail,100); break; case 'image/png': imagepng($thumb_create,$thumbnail,9); break; case 'image/gif': imagegif($thumb_create,$thumbnail,100); break; default: imagejpeg($thumb_create,$thumbnail,100); } } } $sql = "INSERT INTO student (name, picture) VALUES ('$name', , '$file_name')"; $query = $connect->query($sql); if($query === TRUE) { $validator['success'] = true; $validator['messages'] = "Successfully Added"; } else { $validator['success'] = false; $validator['messages'] = "Error while adding the member information"; } // close the database connedction $connect->close(); echo json_encode($validator); }已经存在,var manageMemberTable; $(document).ready(function() { manageMemberTable = $("#manageMemberTable").DataTable({ "ajax": "php_action/admretrieve.php", "order": [] }); $("#addMemberModalBtn").on('click', function() { // reset the form $("#createMemberForm")[0].reset(); // remove the error $(".form-group").removeClass('has-error').removeClass('has-success'); $(".text-danger").remove(); // empty the message div $(".messages").html(""); // submit form $("#createMemberForm").unbind('submit').bind('submit', function() { $(".text-danger").remove(); var form = $(this); // validation var addName = $("#addName").val(); var addImage = $("#addImage").val(); if(addName == "") { $("#addName").closest('.form-group').addClass('has-error'); $("#addName").after('<p class="text-danger">The Name field is required</p>'); } else { $("#addName").closest('.form-group').removeClass('has-error'); $("#addName").closest('.form-group').addClass('has-success'); } if(addName && addImage) { //submi the form to server $.ajax({ url : form.attr('action'), type : form.attr('method'), data : form.serialize(), dataType : 'json', success:function(response) { // remove the error $(".form-group").removeClass('has-error').removeClass('has-success'); if(response.success == true) { $(".messages").html('<div class="alert alert-success alert-dismissible" role="alert">'+ '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ '<strong> <span class="glyphicon glyphicon-ok-sign"></span> </strong>'+response.messages+ '</div>'); // reset the form $("#createMemberForm")[0].reset(); // reload the datatables manageMemberTable.ajax.reload(null, false); // this function is built in function of datatables; } else { $(".messages").html('<div class="alert alert-warning alert-dismissible" role="alert">'+ '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ '<strong> <span class="glyphicon glyphicon-exclamation-sign"></span> </strong>'+response.messages+ '</div>'); } // /else } // success }); // ajax subit } /// if return false; }); // /submit form for create member }); // /add modal });的确没有进一步的工作。您可以只使用实例a.md作为指定目标(前提条件可能取决于pdf和html文件)。或通过变量传递所需的来源,然后从中确定所需的目标。


(后一种)选项是这样的:

make

您可以用a打电话。


另一个选项(以前):

EXPORTED= $(SOURCE:%.md=%.html) $(SOURCE:%.md=%.pdf)

%.html : %.md
        pandoc -o $@ $<

%.pdf : %.md
        pandoc -o $@ $<

all: $(EXPORTED)

允许您呼叫make SOURCE=a.md


但要重申。您不能使用(现有)源作为目标,因为make会(确实如此)得出结论,即已完成该目标。


除了(但我个人并不真的喜欢,因为这使IMO令人困惑),如果您坚持认为,可以对以前的方法进行一些改动...但是可以使用%.html : %.md pandoc -o $@ $< %.pdf : %.md pandoc -o $@ $< .PHONY: $(MAKECMDGOALS) $(MAKECMDGOALS): $(MAKECMDGOALS:%=%.html) $(MAKECMDGOALS:%=%.pdf) 个目标...全部声明为make a。即不是真实文件,总是要考虑/修改:

*.md

现在,您确实可以致电.PHONY。我还是更喜欢上面两个。